I'm building an options page which allows users to choose three posts and three custom images that display on the site's front page. I am using the Settings API to create a custom WP_Query which pulls all posts from 4 different CPTs ('resources', 'events', 'blog posts', and 'publications'), and populates the titles and IDs (hidden) of these posts into a dropdown so a user can select three accordingly.
Everything is working great except for one issue: it seems that the 'publications' post type does not display in the dropdown. Here is the snippet of my custom query setup, tied to the 'admin_init' hook:
add_action('admin_init', 'at_register_homepage_featured_settings');
function at_register_homepage_featured_settings() {
/*
* ...
* register DB option and section which holds it
* ...
*/
/* find all relevant posts to use for dropdown options */
$args = array(
'post_type' => array('at_publications', 'event', 'post', 'at_resources'),
'posts_per_page' => -1,
'orderby' => 'post_type title',
'order' => 'ASC',
'post_status' => 'publish'
);
$post_query = new WP_Query( $args );
/*
* ...
* populate dropdown with $post_query results above
* ...
*/
}
The name of the post type is 'at_publications', and like I mentioned, all other CPTs are displaying correctly within the dropdown. In fact, this code works great on my local install, but just not on the production site.
I looked into what the max limit for a dropdown is, and most modern browsers seem to support thousands of items, so I don't think this is the issue (the 'publications' post type has 65 posts at the moment). Looking for any guidance or suggestions here. Thanks in advance!