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


if i tried this :


// 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


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: