1

I am having a problem with my theme's options panel and a plugin. Apparently they don't get along very well. Anyway, I need to hook 3 functions on a specific page when I am in the admin panel. More exactly, I need to hook 3 theme options's functions only on the theme options page. I tried to do it using the code below but I can't get it to work. I already searched the web for a workaround but I can't manage to find something good.

function load_required_scripts()
{
    if($_GET['page'] === 'theme_options') {
    /* required hooks here */
    }
}
add_action('admin_init', 'load_required_scripts');
2

Try passing the $hook parameter, and hooking into admin_enqueue_scripts:

function load_required_scripts( $hook )
{
    if ( 'theme_options.php' == $hook ) {
    /* required hooks here */
    }
}
add_action( 'admin_enqueue_scripts', 'load_required_scripts' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.