Home › Forums › Support › Big problem with PHP filter “use static page as category archive” This topic has 3 replies, 2 voices, and was last updated 1 year, 6 months ago by Fernando. Viewing 4 posts - 1 through 4 (of 4 total) Author Posts September 27, 2022 at 6:06 am #2355187 Samuel Hello, It’s been 3 years I’m using this function to redirect category archive to static page with same URL : add_filter('request', function( array $query_vars ) { if ( is_admin() ) { return $query_vars; } if ( isset( $query_vars['category_name'] ) ) { $pagename = $query_vars['category_name']; $query_vars = array( 'pagename' => "$pagename" ); } return $query_vars; } ); It seems to not working anymore and all my category pages are now redirected to my homepage ! The weird thing is I have a filter doing the same job with Tags and it’s still working. I’ve deactivated all plugin to see if there was any conflict but problem still there. Please help ! Samuel September 27, 2022 at 6:15 am #2355189 Samuel Sorry I think I’ve found the issue. I’m not using Yoast anymore and the plugin was remove the /category/ part in the archive page URLs. So now I suppose the filter is not working because of this. How could I modify the filter to work again ? September 27, 2022 at 6:30 am #2355205 Samuel Problem is fixed : I managed to remove category prefix (as Yoast was doing) to make it work again. I’ve added a rule to my htaccess : # REMOVE CATEGORY PREFIX RewriteRule ^category/(.+)$ http://mydomain.com/$1 [R=301,L] # END REMOVE CATEGORY PREFIX Don’t know if it’s the best solution ? Open to your advices here. But yeah, it’s working now. September 27, 2022 at 7:23 pm #2355864 Fernando Customer Support Hi Samuel, Glad you resolved the issue. Yes, that’s still the current way to use a static page as a category archive: https://docs.wpshowposts.com/article/use-static-pages-as-category-archives/ If it’s working, then that should be good. Author Posts Viewing 4 posts - 1 through 4 (of 4 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In