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.
Related Posts:
- Prioritize posts in query by meta keys?
- Returning a custom content types with meta values
- post type => ‘any’ not applied my custom queries
- Linking posts together with Advanced Custom Fields “both ways”
- Query Posts From Multiple Post Types
- Query all posts where a meta key does not exist
- Meta query with boolean true/false value
- Get post with multiple meta keys and value
- How to use a custom post type as front page?
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- Querying Posts by Taxonomy From Alternate Network Site
- Query by 2 values of a repeater ACF field
- Wp-query causing problems with the_content();
- How to create posts (not post template) to be displayed on projects page?
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- Include both default and Custom Post Type in query modified inside pre_get_posts
- Automatically adding meta data to posts or multiple query help
- Having trouble with custom date field for CPT query (WordPress)
- Quickest way to get last or oldest post date – WP Query
- How do I create an archive page for standard posts?
- Conditional to modify query results
- Loop on front-page.php
- Is it possible to create a shortcode that will query a post based on taxonomies?
- WP_Query is printing out only one post when posts_per_page is set to multiple
- Querying Term Posts in Loop
- Use get_post_types to query only custom posts types
- orderby in custom WP Query does not work
- Display custom post type from dynamic custom field
- Show the same Article Available in Other Categories
- Show custom post type filtered by category
- Search / Filter posts on Title/Content OR Tags
- Get latest 3 posts from multiple CPT in one query
- Meta query for custom post type ignored in main query
- Two Custom Post Types Many to Many Relationship
- creat filter with wp_query
- Several post types on WP Query by tag and taxonomy
- Update postmeta Parent when post_status child change
- WordPress request fiter order by related post’s post_title
- Different Limit number of post on different archive page
- Custom post types and ‘new WP_Query’
- Displaying a div from an assigned meta_value when on a page
- How to get specific post meta by title or id
- WP_Query with custom post type ID
- $post->post_meta not pulling any post in wordpress/php
- WP_Query of custom post type sorted by meta_key has unexpected results
- Batch Extract Date from post title and put into ACF custom field
- display posts of custom post type with custom taxonomy
- How to Query in WordPress which shows Alphabetic Posts?
- is_main_query() never called on WP 4.4
- How to query Posts from a custom post type which contains a custom taxonomy?
- Create query for both custom post type and category
- Display post from custom post type
- How to retrive Custom Post Type Meta Fields in Custom WP_Query
- How to fetch posts that are stored in the different table than (default) wp_posts?
- Is there a (preferable built-in) way to check what custom queries are used in a theme?
- After inserting new post with wp_insert_post() the post is not visble to WP_Query, but the same WP_Query works for post inserted from wp-admin panel
- WP Query from two Custom Post type fields as statement
- Get_post_custom not fetching value from array wordpress
- WP Query: If field X is empty, show posts based on field Y
- SELECT custom post type and its meta in SQL
- Save data is post using php front end
- how to display posts content on the custom css popup by clicking on each title on the sidebar?
- Use WP_query to match post types based on custom field values
- How to sort by multiple values in a nested WP_Query
- SEARCH QUERIES – REVERSE OUTPUT
- How do I insert a custom post type query after a certain number of recent posts and then resume recent posts?
- WP_Query for custom taxonomies showing posts from non-specified terms?
- Custom meta fields not showing up in WP_Response Object via custom endpoint
- How to get post by meta value
- WP_Query with all posts in one custom post type and only posts in another custom post type with a specific category
- How to properly get the wp_postmeta.meta_value of a custom post type in specifics?
- How do I get all authors posts of a custom post type outside loop
- minimize wp_query call to database
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- subtracting the current post form then whole loop, which is generating all CPT titles
- Custom Post By Category
- Custom post Query and WordPress Post Query Clash
- update a posts of other custom post type
- Get post from Category by Priority
- Only show current category post
- How to get post meta for custom post type and taxonomy
- get_post_meta for Custom Post Type ( CPT )
- Get posts of an specific term of a custom taxonomy
- Conditional posts in WP_query for search
- How To Loop Through list with Custom Post Types
- Is it possible to add query parameters on the archive page?
- meta query always fails even if data is correct
- Calling specific page with wp query
- Values inside a custom field to determine which category posts to display
- How to create content automatically when a post is published?
- Display a post count from a custom metabox selection
- Query Only Show Text on Posts With Certain Taxonomy Tag
- Retrieving IDs of child pages which are in a different post type
- Post content stays the same but permalink changes ?
- Retrieve post data via WPDB class
- Cannot exclude particular post from loop of custom post type
- How do I hide single category post on my post page
- Automatically add custom taxonomy when meta value gets to a set number or beyond
- Load posts via AJAX without draft status