Hook specific functions if on a specific admin page

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');

Related posts

1 comment

  1. 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' );
    

Comments are closed.