How to use option_rewrite_rules filter

I am asking about how to use the “post_rewrite_rules” filter

https://codex.wordpress.org/Plugin_API/Filter_Reference/post_rewrite_rules

if i tried this :

http://hookr.io/filters/option_rewrite_rules/

// define the post_rewrite_rules callback 
function filter_post_rewrite_rules( $post_rewrite ) { 
            $post_rewrite2 = array();
            $post_rewrite2["$"]                         = "index.php?pagename=firefox";
            $post_rewrite2["page/?([0-9]{1,})/?$"]          = "index.php?pagename=firefox". "&paged=$matches[1]";
            $post_rewrite = $post_rewrite2;

    return $post_rewrite;
}; 

// add the filter 
add_filter( 'post_rewrite_rules', 'filter_post_rewrite_rules', 10, 1 ); 

but nothing happened maybe my function is wrong

Any idea ?

And what is the difference between the “option_rewrite_rules” filter and the “post_rewrite_rules” filter ?

Read more here: How to use option_rewrite_rules filter

Leave a Reply

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