0
votes

I am trying to load the script in one my custom made submenu pages in wordpress admin, it works well for the main menu pages like:

http://www.mydomain.com/wp/wp-admin/edit.php?post_type=product

but not for a submenu page:

http://www.mydomain.com/wp/wp-admin/edit.php?post_type=product&page=my-products

function pw_load_scripts($hook) {
if( $hook != 'edit.php' ) // load in edit page only
    return;
1

1 Answers

1
votes

Try this one:

Put this condition:

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

$postData = query_posts('category_name='.$slug.'&post_status=publish,future&paged='.$paged);

if($postData[0]->slug == 'page slug name'){
    <script> </script>
}

Thanks.