Custom post type broken after WordPress 3.8 upgrade
-
Hi, I am using event listing post type arranged by dates and it has stopped working after the upgrade. Here is the code which is in functions.php:
add_filter( 'pre_get_posts', 'filter_upcoming' ); function filter_upcoming( $query ) { if ( !is_admin() && is_category('events') && $query->is_main_query() ) { $currentdate = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-3,date("Y"))); $meta_query = array( array( 'key' => 'eventdate' , 'value' => $currentdate, 'compare' => '>' ), ); $query->set( 'meta_key', 'eventdate' ); $query->set( 'orderby', 'meta_value' ); $query->set( 'order', 'ASC' ); $query->set( 'meta_query', $meta_query ); } return $query; }
From what I have read on other post, the problem was something to do with is_category(‘events’).
Hope there is a solution for this.
- The topic ‘Custom post type broken after WordPress 3.8 upgrade’ is closed to new replies.