• Resolved webam

    (@webam)


    Hello I would like to solve a small problem in the automatic category permalink. In precision, on the sub-categories. When a user clicks on a category when it is searched for example, if I look for the subcategory cars, the main category is motors, then the slug should be https://www.annuncigratuiti.com/annunci-italia/motors/cars

    but to invoke if I click on cars subcategory, the slug now is https://www.annuncigratuiti.com/annunci-italia/cars (without motors, so without main category of subcategory)

    Without the main category in the slug, it’s not good. In the long run there will be confusion when there will be too many categories and these things must be fixed now. You are the author of what you have created should be extremely simple for you to make this change in the slug / permalink. Also the yoast seo or rank math plugin tells me that the slog should be category / subcategory

    how can I do?

    seo1
    seo3
    seo4

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Add in theme functions.php the code below to change how the links for categories are generated

    
    add_action("adverts_register_taxonomy", function( $args, $type ) {
        if( $type != "advert_category" ) {
            return $args;
        }
        if(!isset($args["rewrite"])) {
            $args["rewrite"] = array();
        }
        $args["rewrite"]["hierarchical"] = true;
        return $args;
    }, 10, 2 );
    
    Thread Starter webam

    (@webam)

    Work perfect. Thankyou Greg

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Repair / edit slug of subcategory with complete mode’ is closed to new replies.