• mufi

    (@mufi)


    I need to create rewrite rule to get all category and sub category of product on one page like

    localhost/wordpress/custom-page/static-cat/sub-category

    iam using following code
    `function add_rewrite_rules($aRules) {
    //add_rewrite_rule(‘residential/([^/]+)/?’, ‘index.php?pagename=residential&sub_category=$matches[1]’, ‘top’);

    $aNewRules = array(‘custom-page/static-cat/([^/]+)/?$’ => ‘index.php? pagename=custom-page&sub_category=$matches[1]’);
    $aRules = $aNewRules + $aRules;
    return $aRules;
    }
    function add_query_vars($query_vars) {
    $query_vars[] = ‘sub_category’;
    return $query_vars;
    }
    add_action(‘rewrite_rules_array’, ‘add_rewrite_rules’);
    add_filter(‘add_query_vars’, ‘add_query_vars’);

    NOTE: iam getting filter listed in wp_rewrite->rewrite_rules function
    by they are not affecting even i tried a simple one with any param still not working as shown
    $aNewRules = array(‘shopss/?$’ => ‘index.php?pagename=custom-page’);
    can anyone point out what’s wrong in this

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Custome Rewrite not working’ is closed to new replies.