Rewriting URL using WordPress add_rewrile_rule not working

Question

I am trying to create the following rule on page load but for some reason, it is not working.

This is my code I want to rewrite this slug:
http://dev.local/cases/?_sft_themas=fruit

Rewrite to:
http://dev.local/cases/thema/fruit/

How can I do this? Thanks in advance.

My code:

add_action( 'init', 'add_author_rules' );
function add_author_rules() {
    add_rewrite_rule('cases/?$','/cases/?_sft_themas=$matches[1]','top');
}
0
Galanthus 2 months 0 Answers 17 views 0

Leave an answer