Reputation: 73
I have a big problem and i dont know how to solve it. I have noticed that at dashboard when i pressed on "all posts" i get this ugly error: "Invalid post type" nothing more nothing less
I have tried a lot of things: 1. Update to latest version 2. Roll back to 3.9.1 3. Deactivated/activated all plugins 4. Deactivated custome theme 5. Modify edit.php locate in wp-admin folder and set this
$typenow = 'post';
if ( ! $typenow )
wp_die( __( 'Invalid post type' ) );
After this modification the "invalid post type" error was gone but when I was trying to modify a post at dashboard I noticed that the right column (category select, preview etc) was missing. Does anyone knows how to fix this problem? Any ideas? Thank you in advance,
P.S: Please follow those links to see what I am trying to explain https://dl.dropboxusercontent.com/u/5502709/wp.png https://dl.dropboxusercontent.com/u/5502709/wp1.png
Upvotes: 1
Views: 12415
Reputation: 31
Same issue here as described by Kevin4fm:
When I select multiple items for moving to trash and after I hit the button, I can see the following URL in the adress bar of my browser together with the message "invalid post type":
http://example.com/wp-admin/edit.php?s=&post_status=all&post_type=Array&author=5&_wpnonce=67fdf1328g&_wp_http_referer=%2Fwp-admin%2Fedit.php%3Fpost_type%3DCPT%26author%3D5&action=trash&m=0&cat=0&paged=1&post%5B%5D=9462&post%5B%5D=7093&action2=-1
So I have changed the URL to the following and it works fine:
http://example.com/wp-admin/edit.php?s=&post_status=all&post_type=CPT&author=5&_wpnonce=67fdf1328g&_wp_http_referer=%2Fwp-admin%2Fedit.php%3Fpost_type%3DCPT%26author%3D5&action=trash&m=0&cat=0&paged=1&post%5B%5D=9462&post%5B%5D=7093&action2=-1
So changing post_type=Array
to post_type=CPT
(CPT = name of custom post type) in the adress bar of the browser does the job.
But I can't find any bugs nor in my CPT neither in my theme functions.php, so the reason must be somewhere else...
Upvotes: 1
Reputation: 51
Late to the party, but I share this in case anyone comes looking with a similar problem to solve. It isn't a 'fix' but seems to be a 'workaround'.
I'm getting the "Invalid post type" error when I try to edit multiple custom posts in the edit screen. I think I may know a plugin that is causing it, but it's so integral to my site I can't just disable it, even just while I do the editing, so I was faced with the choice of either doing a LOT of individual edits, or coming up with a solution. This is what is working for me:
Set up all of the editing you want as normal. On 'enter' you get the "Invalid post type" message ... but the command phrase is still in the browser bar. Part of the phrase contains'post_type='. For me, at least, rather than the post type I'm trying to edit, it's showing the word 'Array'. By over typing that word with the actual custom post type name, then hitting 'enter' again it processes correctly. (I'm getting a message, but it's a notification or warning rather than an actual error message.)
Hope this helps someone. :-)
Upvotes: 5
Reputation: 73
First of all thank you for helping me. I solved this problem but I dont understand what the problem was. First I removed all the folders of wordpress installation and upload an old backup of my website but the problem was still there. Then I start deleting one by one all the plugins and after each deletion I was checking the behaviour, finally when I deleted this plugin WP Super Cache (which by the way was deactivated) everything worked perfect. The strange think is that when I restore all folders of the wordpress installation the plugin was there but the problem was gone... So even thought the problem is gone I am not sure for the solution.
My suggestion to anyone with the same problem: Delete plugins not just deactivate.
Upvotes: 0