Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created February 24, 2021 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/4495f0e3957b2123c216e9d55121b658 to your computer and use it in GitHub Desktop.
Save Pebblo/4495f0e3957b2123c216e9d55121b658 to your computer and use it in GitHub Desktop.
Example of how to remove the post_where filter used in the Royal Event theme which prevents the use of custom post statuses.
<?php //Please do not include the opening PHP tag if you already have one.
add_filter( 'posts_where', 'tw_ee_remove_royal_event_query_posts_where', 9, 2 );
function tw_ee_remove_royal_event_query_posts_where($where, $query) {
if( $query->query_vars['post_type'] == 'espresso_events' ) {
remove_filter( 'posts_where', 'royal_event_query_posts_where' );
}
return $where;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment