Home › Forums › Pro Support › Filtering category views to showpost pages › Reply To: Filtering category views to showpost pages
August 8, 2019 at 4:59 pm
#10663
Keymaster
Ah, good point.
I wonder if this would work?:
add_filter('request', function( array $query_vars ) {
if ( is_admin() ) {
return $query_vars;
}
if ( isset( $query_vars['category_name'] ) ) {
$pagename = $query_vars['category_name'];
if ( get_page_by_title( $pagename ) ) {
$query_vars = array( 'pagename' => "$pagename" );
}
}
return $query_vars;
} );
Let me know 🙂