Leave a Reply

2 comments

  1. The plugin ‘Post Types Order‘ was the culprit. As Scribu pointed out above the plugin is filtering the Raw SQL query which it shouldn’t be doing. As a result, the argument ‘suppress_filters‘ wasn’t stopping the query being modified and the ‘orderby‘ argument was being completely ignored.

    As to how this behavior can be stopped, I’m not sure. I solved my issue by disabling the plugin as it wasn’t even being used. However, you can set the order of your custom post type menus in your register_post_types code instead, using the ‘menu_position‘ argument which decides where the menu will be placed.

    Documentation for ordering your post types in the WordPress admin menu can be found here in the official WordPress documentation.

    The lesson learned here is that you should always assume that a plugin has broken something, especially if you are using code from the official documentation that works.