Add_rewrite_rule doesn’t add rule to DB

I have a problem with adding a new Rewrite rule. Although the code seems to be correct, it doesn’t add a rule to the database. Ofc I flushed the rules manually.

add_action( 'init', 'wpa5413_init' );
function wpa5413_init()
        'top' );
add_filter( 'query_vars', 'wpa5413_query_vars' );
function wpa5413_query_vars( $query_vars )
    $query_vars[] = 'q';
    return $query_vars;

My link looks like this:
And I want this:

In my other site this code works perfectly fine. But when I add this to my friends site (also in wordpress) it doesn’t. What could be wrong?

Read more here: Add_rewrite_rule doesn’t add rule to DB

Leave a Reply

Your email address will not be published. Required fields are marked *