Changes to Registering Custom Post Types in WordPress 4.4

Whilst building a plugin recently I found a change in WordPress 4.4 which actually broke my plugin, but was very easy to fix. The problem was with a custom post type that had completely disappeared from the admin menu. Here is why it disappeared and how I got it back again!

First a little background about the plugin in question. It used a post type in order for the user to add a single post. The content of this single post was then outputted with a shortcode and therefore I did not want the post type to have a permalink page at all. For this I had set the public argument used in register_post_type() to false. I also did not want the regular post type menu item to show in the backend, as I was adding my own menu item and therefore I had set the show_ui argument to false too. This worked fine in WordPress 4.3.1 and when I added my own menu item using add_menu_page() which used the edit post screen for the content for a post within the custom post type the menu item showed up no problem.

When I recently upgraded the site to WordPress 4.4 there was a large problem. The menu item completed disappeared. After some digging around and making some changes to test what was going on, I found the problem. The fix was to set show_ui to false but to set show_in_menu to true.

When I tweeted about this issue, John Blackbourn, one of the core developers kindly responded with a link to a post outlining the changes.

Leave a Reply

Your email address will not be published. Required fields are marked *