Custom post type: No posts found even if counter has a count

My pre get posts functions went sideways. My condition was applying for all archives, not just the events one. Here is the code that is right. Notice the is_post_type_archive. function pix_change_query( $query ) { if ( is_post_type_archive(‘pix_events’) && $query->is_main_query() ) { $query->set( ‘orderby’, ‘meta_value_num’ ); $query->set( ‘meta_key’, ‘date_work’ ); $query->set( ‘meta_type’, ‘DATE’ ); $query->set( ‘order’, … Read more

Ordering Custom Post Types with WP_Query

Here’s a plugin that uses the posts_orderby filter to support a custom _post_type__in orderby in WP_Query that orders the post types by their array placements: <?php /** * Plugin Name: Support for _post_type__in orderby in WP_Query * Plugin URI: https://wordpress.stackexchange.com/a/392910/26350 */ add_filter ( ‘posts_orderby’, function ( $orderby, \WP_Query $q ) use ( $wpdb ) { … Read more

sortable columns on a custom post type won’t work

i believe the right hook for displaying the actual column content (each line) is manage_{$post_type}_posts_custom_column so change in your code: add_action( ‘manage_event_custom_column’, ‘event_date_column_display’, 10, 2 ); to: add_action( ‘manage_event_posts_custom_column’, ‘event_date_column_display’, 10, 2 );