[resolved] Pages and post taxonomy pretty URL (3 posts)

  1. sebastienlavoie
    Posted 2 years ago #

    I have to ship different pages and, on a blog section, different posts according to a country taxonomy. So a page could show up in USA and Canada and another one could show up in France and Italy depending on what countries the author has checked. Users get content associated with their country.

    What I would like to have is URLs like :


    I registered a custom taxonomy :

    $labels = array(
    'name' => 'Country'

    $args = array(
    'labels' => $labels,
    'public' => true,
    'show_in_nav_menus' => false,
    'show_ui' => true,
    'hierarchical' => true,
    'rewrite' => true

    register_taxonomy( 'country', array('page', 'post'), $args );

    I googled around and did not find much talking about how to automatically format pages slugs. I tried changing permalinks using %country% but, as I expected, it didn't do anything.

    What would I have to do to rewrite pages slugs dynamically and add the value of my country taxonomy before the slug? Or am I just doing it wrong?


  2. bcworkz
    Posted 2 years ago #

    Have you looked over Rewrite API? You should be able to get something working using it.

  3. sebastienlavoie
    Posted 2 years ago #

    Okay finally I decided to go with a multisite setup, it gives me more option for the future. Thanks ;)

Topic Closed

This topic has been closed to new replies.

About this Topic