Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've set up some admin pages using add_sub_menu() and whenever I add an additional querystring variable beyond the "page=" portion of the URL, I get a "Cannot load 'page-slug'." message. When I remove the every variable the page loads correctly. Here is my add menu code:

add_submenu_page(
  'plugin-slug',
  __( 'Post Types - Add', 'plugin-slug' ),
  null,
  'manage_options',
  'plugin-slug-posttypes-add',
  'display_admin_page_posttype_add'
);

If I browse to:

/wp-admin/admin.php?page=plugin-slug-posttypes-add

it works fine. But browsing to:

/wp-admin/admin.php?page=plugin-slug-posttypes-add&post_type=sampletype

returns:

Cannot load content-toolkit-posttypes-add.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You're recieving this error because WordPress notices the post_type query argument and that sampletype is a valid registered post type, and thinks you're on an edit page. Try using a different query arg then post_type.

Note that admin.php?page=plugin-slug-posttypes-add&post_type=thisisnotaposttype and admin.php?page=plugin-slug-posttypes-add&foo=bar will both work fine.

share|improve this answer
    
I didn't realize using that specific variable name would affect it. Thanks! –  hereswhatidid Jun 15 '13 at 14:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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