Title: &quot;invalid post type&quot; error with dropdown menu?
Last modified: August 20, 2016

---

# "invalid post type" error with dropdown menu?

 *  Resolved [speedyp](https://wordpress.org/support/users/speedyp/)
 * (@speedyp)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/invalid-post-type-error-with-dropdown-menu/)
 * Hey – I love this plugin & want to use it on a multisite, but I’ve hit a major
   problem. I’m using a function which gives a dropdown category menu when a user
   selects new post. This makes them choose a category BEFRORE the post is created.
   The problem is that adminimize is causing an “invalid post type” error. I disabled
   all other plugins & I’ve tried all different settings but result is the same.
 * PLEASE PLEASE PLEASE take a look at the code I’m using in functions.php and give
   me an idea why adminimize hates it… thanks!
 * ‘//ADD DROPDOWN MENU TO CHOOSE NEW POST CATEGORY (CHOOSE THE CAT ID’S YOU WANT
   TO APPEAR)
    add_filter( ‘load-post-new.php’, ‘wpse14403_load_post_new’ ); function
   wpse14403_load_post_new() { $post_type = ‘post’; if ( isset( $_REQUEST[‘post_type’])){
   $post_type = $_REQUEST[‘post_type’]; } // Only do this for posts if ( ‘post’ !
   = $post_type ) { return; } if ( array_key_exists( ‘category_id’, $_REQUEST ) ){
   add_action( ‘wp_insert_post’, ‘wpse14403_wp_insert_post’ ); return; } // Show
   intermediate screen extract( $GLOBALS ); $post_type_object = get_post_type_object(
   $post_type ); $title = $post_type_object->labels->add_new_item; include( ABSPATH.‘
   wp-admin/admin-header.php’ ); $dropdown = wp_dropdown_categories( array( ‘orderby’
   => ‘name’, ‘include’ => ‘3, 4’, ‘name’ => ‘category_id[]’, ‘hide_empty’ => false,‘
   echo’ => false, ) ); $category_label = __( ‘Create New’ ); $continue_label = 
   __( ‘Continue’ ); echo <<<HTML <div class=”wrap”> <h2>{$title}</h2> <form method
   =”get”> <table class=”orange”> <tbody> <tr valign=”top”> <th scope=”row”>{$category_label}
   </th> <td>{$dropdown}</td> </tr> <tr> <td></td> <th><input name=”continue” type
   =”submit” class=”button-primary” value=”{$continue_label}” /></th> </tbody> </
   table> <input type=”hidden” name=”post_type” value=”{$post_type}” /> </form> 
   </div> HTML; include( ABSPATH . ‘wp-admin/admin-footer.php’ ); exit(); } // This
   function will only be called when creating an empty post, // via `get_default_post_to_edit()`,
   called in post-new.php function wpse14403_wp_insert_post( $post_id ) { wp_set_post_categories(
   $post_id, $_REQUEST[‘category_id’] ); }’
 * [http://wordpress.org/extend/plugins/adminimize/](http://wordpress.org/extend/plugins/adminimize/)

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Thread Starter [speedyp](https://wordpress.org/support/users/speedyp/)
 * (@speedyp)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/invalid-post-type-error-with-dropdown-menu/#post-3176758)
 * UPDATE / MORE INFO. On further investigation, I changed a bit of my code towards
   the end from hidden to text. This reveals an input field that is usually hidden
   and automatically filled with the post type “post”. The adminimize plugin appears
   to prevent this from happening, even though I have not set it to hide anything?
   All settings are unchecked..
 * <input type=”text” name=”post_type” value=”{$post_type}” />
 * Any ideas on this?
 *  Plugin Contributor [Frank Bueltge](https://wordpress.org/support/users/bueltge/)
 * (@bueltge)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/invalid-post-type-error-with-dropdown-menu/#post-3176760)
 * What is the error message? Is the invalid post type message from WP or PHP error.
   PLease set WP_DEBUG to TRUE and read the errors.
 *  Thread Starter [speedyp](https://wordpress.org/support/users/speedyp/)
 * (@speedyp)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/invalid-post-type-error-with-dropdown-menu/#post-3176761)
 * Hey Frank – the error message is simply “invalid post type”. It appears in a 
   small white box, but I’m not familiar enough with wp or php to say what is generating
   the message.
 * I just started trying debug mode for first time & I’m scared :O
 * Really hope we can get this sorted – I’ve put a ton of work into this & am depending
   on your plugin to make life simple for my multisite users. I’ll get back to you
   if I can find any more info
    Thanks
 *  Plugin Contributor [Frank Bueltge](https://wordpress.org/support/users/bueltge/)
 * (@bueltge)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/invalid-post-type-error-with-dropdown-menu/#post-3176762)
 * Can you send me your plugin or theme with your source, that I check this on my
   dev install?
 *  Thread Starter [speedyp](https://wordpress.org/support/users/speedyp/)
 * (@speedyp)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/invalid-post-type-error-with-dropdown-menu/#post-3176763)
 * Here’s a debug list generated when trying to create a new post from my dropdown
   menu. I’m surprised at the number of errors as everything normally works very
   well. Maybe it will give you a clue where the problem lies?
 * > Notice: wp_enqueue_script was called incorrectly. Scripts and styles should
   > not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts,
   > or init hooks. Please see Debugging in WordPress for more information. (This
   > message was added in version 3.3.) in /home/speedyp/public_html/wp-includes/
   > functions.php on line 2758
   > Notice: wp_enqueue_style was called incorrectly. Scripts and styles should 
   > not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts,
   > or init hooks. Please see Debugging in WordPress for more information. (This
   > message was added in version 3.3.) in /home/speedyp/public_html/wp-includes/
   > functions.php on line 2758
   > Notice: Undefined variable: my_menu in /home/speedyp/public_html/wp-content/
   > themes/solution/includes/core-additions.php on line 68
   > Notice: Use of undefined constant THEMENAME – assumed ‘THEMENAME’ in /home/
   > speedyp/public_html/wp-content/themes/solution/admin/ttpanel/theme-options.
   > php on line 1494
   > Notice: Use of undefined constant THEMENAME – assumed ‘THEMENAME’ in /home/
   > speedyp/public_html/wp-content/themes/solution/admin/ttpanel/theme-options.
   > php on line 1495
   > Notice: Use of undefined constant THEMENAME – assumed ‘THEMENAME’ in /home/
   > speedyp/public_html/wp-content/themes/solution/admin/ttpanel/theme-options.
   > php on line 1506
   > Notice: Use of undefined constant THEMENAME – assumed ‘THEMENAME’ in /home/
   > speedyp/public_html/wp-content/themes/solution/admin/ttpanel/theme-options.
   > php on line 1507
   > Notice: Use of undefined constant THEMENAME – assumed ‘THEMENAME’ in /home/
   > speedyp/public_html/wp-content/themes/solution/admin/ttpanel/theme-options.
   > php on line 1522
   > Notice: Use of undefined constant THEMENAME – assumed ‘THEMENAME’ in /home/
   > speedyp/public_html/wp-content/themes/solution/admin/ttpanel/theme-options.
   > php on line 1523
   > Notice: Use of undefined constant THEMENAME – assumed ‘THEMENAME’ in /home/
   > speedyp/public_html/wp-content/themes/solution/admin/ttpanel/theme-options.
   > php on line 1538
   > Notice: Use of undefined constant THEMENAME – assumed ‘THEMENAME’ in /home/
   > speedyp/public_html/wp-content/themes/solution/admin/ttpanel/theme-options.
   > php on line 1539
   > Notice: Undefined index: action in /home/speedyp/public_html/wp-content/themes/
   > solution/admin/ttpanel/ttpanel.php on line 46
   > Notice: Undefined index: action in /home/speedyp/public_html/wp-content/themes/
   > solution/admin/ttpanel/ttpanel.php on line 53
   > Notice: Trying to get property of non-object in /home/speedyp/public_html/wp-
   > admin/includes/template.php on line 871
   > Notice: Trying to get property of non-object in /home/speedyp/public_html/wp-
   > admin/includes/template.php on line 871
   > Notice: Undefined index: page in /home/speedyp/public_html/wp-content/themes/
   > solution/admin/ttpanel/ttpanel.php on line 9
   > Invalid post type
 *  Thread Starter [speedyp](https://wordpress.org/support/users/speedyp/)
 * (@speedyp)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/invalid-post-type-error-with-dropdown-menu/#post-3176764)
 * Delighted to send you anything that might help, or just give you site access 
   if that’s easier – how could we do that in a non public way??
    Cheers
 *  Plugin Contributor [Frank Bueltge](https://wordpress.org/support/users/bueltge/)
 * (@bueltge)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/invalid-post-type-error-with-dropdown-menu/#post-3176765)
 * send me a mail: [http://about.me/frankbueltge](http://about.me/frankbueltge)
 *  Thread Starter [speedyp](https://wordpress.org/support/users/speedyp/)
 * (@speedyp)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/invalid-post-type-error-with-dropdown-menu/#post-3176767)
 * Email sent – thanks 🙂
 *  Thread Starter [speedyp](https://wordpress.org/support/users/speedyp/)
 * (@speedyp)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/invalid-post-type-error-with-dropdown-menu/#post-3176770)
 * FANTASTIC SUPPORT – THANKS

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘"invalid post type" error with dropdown menu?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/adminimize_000000.svg)
 * [Adminimize](https://wordpress.org/plugins/adminimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/adminimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/adminimize/)
 * [Active Topics](https://wordpress.org/support/plugin/adminimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/adminimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/adminimize/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [speedyp](https://wordpress.org/support/users/speedyp/)
 * Last activity: [13 years, 7 months ago](https://wordpress.org/support/topic/invalid-post-type-error-with-dropdown-menu/#post-3176770)
 * Status: resolved