• I want add a rewrited extra param on my category page like this:

    https://www.example.com/mycategory/mycustomparam/

    On my plugin file I wrote:

    <?php
    function add_my_var($public_query_vars) {
        $public_query_vars[] = 'mycustomparam';
        return $public_query_vars;
    }
    
    add_filter('query_vars', 'add_my_var');
    
    function do_rewrite() {
        add_rewrite_rule('mycategory/([^/]+)/?$', 'index.php?category_name=mycategory&mycustomparam=$matches[1]','top');
    }
    
    add_action('init', 'do_rewrite');
    ?>

    I get a 404 page. Where am I doing wrong?

  • The topic ‘Add rewrited extra params in category page’ is closed to new replies.