• I want to create a custom permalink based on a custom-post type and and 3 types of custom taxonomy
    in this way:
    mysite.com/custom-taxonomy-1/custom-taxonomy-2/custom-taxonomy-3/postname.html

    How it works?

Viewing 15 replies - 1 through 15 (of 16 total)
  • /%postname%/

    Add that in ‘Custom Structure’ option under ‘Settings -> Permalinks’ in your admin area, and you will get URLs like –

    mysite.com/custom-taxonomy-1/postname.html
    mysite.com/custom-taxonomy-2/postname.html
    mysite.com/custom-taxonomy-3/postname.html

    To make it as you have written above I believe that you would need to manually write some rewrite rules, which is beyond my field of expertise. That is unless custom-taxonomy-3 is a child of custom-taxonomy-2, which in turn is a child of custom-taxonomy-1 – if that is the case then simply adding the /%postname%/ should be enough.

    Thread Starter serdominik

    (@serdominik)

    For a second forget to use the custom post type.
    Come on in articles into categories and create:

    Tutorials
    -Programming
    --PHP
    --ASP

    and create an article “Connect to dbms” and assign the category PHP
    In ‘Settings -> Permalinks -> Custom Structure’ add:
    /%category%/%postname%.html
    The permalink the article is created is:
    mysite.com/tutorials/programming/php/connect-to-dbms.html
    so everything is ok!!!

    but because the same permalink structure does not work for custom post type using custom taxonomy?

    It should do, regardless of whether it’s a custom taxonomy or a built in taxonomy (‘catetory’, ‘post_tag’), it’s still a taxonomy so will follow the same rules.

    From the codex for register_taxonomy()

    rewrite
    (boolean or array) (optional) Set to false to prevent rewrite, or array to customize customize query var. Default will use $taxonomy as query var
    Default: true
    $args array
    ■’slug’ – prepend posts with this slug – defaults to taxonomy’s name
    ■’with_front’ – allowing permalinks to be prepended with front base – defaults to true
    ■’hierarchical’ – true or false allow hierarchical urls (implemented in Version 3.1)

    What that say is that you should add the key ‘hierarchical’ to your rewrite array when you register the taxonomy. Should also work for registering post types.

    Thread Starter serdominik

    (@serdominik)

    Can you give me an example for: custom post type and custom taxonomy?

    I am using this:
    In custom post type:
    [Code moderated as per the Forum Rules. Please use the pastebin]

    And custom taxonomy:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    The result is this:
    mysite.com/prodotti/name-prodotti
    but I need:
    mysite.com/cat1/subcat1/subcat-subcat1/name-product
    but better to create the structure of the permalinks to my pleasure interacting with both the taxonomy that the post

    Thread Starter serdominik

    (@serdominik)

    up please!

    Thread Starter serdominik

    (@serdominik)

    up!

    hi, serdominik!
    did you get? i’m with the same problem ??

    Thread Starter serdominik

    (@serdominik)

    I have not found the solution!

    ??
    if i find, i tell you.

    Thread Starter serdominik

    (@serdominik)

    Thank you very much!
    If I find something I’ll know

    Thread Starter serdominik

    (@serdominik)

    I already knew!
    I made attempts in the past but with poor results.
    I returned a 404 error with simple articles or pages

    Thread Starter serdominik

    (@serdominik)

    To you working? if you can leave your code example?

    I’m trying to run. I think that is what we need.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Create custom Permalink with custom post type and custom taxonomy’ is closed to new replies.