I have a weird bug where I created a custom post type, started to create posts in it and when I went back on the WP-Admin page listing all of the posts of that custom post type, no posts are found. Even if the counter over the list lists 7 found posts.
I've got another custom post type in my site, with the exact same setup (except names), that works normally too.
Anybody encountered that bug before?
EDIT: I've found what was bugging, but now dont know how to fix it. Yes, in use a pre_get_posts to change an unrelated query, but it only acts on the post type pix_events and so it screws up every custom post type except events.
I guess i'm missing a return for default, but can't find what I am supposed to return in that case.
function pix_change_query( $query ) {
if ( is_archive('pix_events') ) {
$query->set( 'orderby', 'meta_value_num' );
$query->set( 'meta_key', 'date_work' );
$query->set( 'meta_type', 'DATE' );
$query->set( 'order', 'ASC' );
$query->set( 'meta_query', array(
array(
'key'=>'date_work',
'compare'=>'>=',
'value'=>date('Ymd'),
'type'=>'DATETIME',
)
) );
}
}
add_filter( 'pre_get_posts', 'pix_change_query' );
pre_get_posts
for example?