Home › Forums › Pro Support › Use Static Pages as Category Archives › Reply To: Use Static Pages as Category Archives
July 30, 2019 at 4:57 pm
#10527
Keymaster
Try this:
add_filter('request', function( array $query_vars ) {
if ( is_admin() ) {
return $query_vars;
}
$targets = array(
'My name here',
'Another',
'One More Name',
);
if ( isset( $query_vars['category_name'] ) && in_array( $query_vars['category_name'], $targets ) ) {
$pagename = $query_vars['category_name'];
$query_vars = array( 'pagename' => "$pagename" );
}
return $query_vars;
} );
Then adjust the names of the categories you want to target in the $targets
array.