Support » Fixing WordPress » add_rewrite_rule. Please help!!!

  • I want to rewrite the URL below:



    Details below:

    With WordPress Permalink Settings set to “Post name”, my current portfolio URL is:

    My links on this page points to:

    pslug is the custom parameter I added.

    my functions.php

    function add_query_vars($vars){
        $vars[] = "pslug";
        return $vars;
    add_filter('query_vars', 'add_query_vars');
    function add_portfolio_rules() {
        add_rewrite_rule('portfolio/([^/]+)/?$', 'index.php?page_id=117&pslug=$matches[1]', 'top');
    add_action('init', 'add_portfolio_rules');

    Please help!!! I have tried everything but nothing works.

  • The topic ‘add_rewrite_rule. Please help!!!’ is closed to new replies.