Support » Plugins » How to WordPress dynamic url prefix based on taxonomy

  • I’m developing an offers site using wordpress. We are trying to offer different offers regarding the city.

    So we have two taxonomies (category and city).

    The thing is that I don’t want to use the normal url structure, I wish it could be:

    root -> http://site .com/city-taxonomy
    category -> http://site .com/city-taxonomy/category
    offer -> http://site .com/city-taxonomy/offer-slug

    Basically I want to split my site in cities without using a multiple site (network) in wordpress so i don’t need to repeat categories or custom fields. I want to maintain the current wordpress url system how its working but adding the prefix I can read from php using GET

    The if anybody manage to do this, I’d like to know how will you handle the url creating in the template, using the city as a prefix, global variable should be enoght.

    I thought about creating city as category and subcategories, but I’d need to repeat all the subcategories for each one.

    One offer could be included in several cities and one category.

    I readed about the rewrite rules functions in wordpress php but I think it should be faster if I do this in htaccess.

    The thing is that after including a rule like:

    RewriteRule ^([^/]+)/? index.php?city=$1 [L]

    This is always redirecting me to search functionality in wordpress, and I don’t know if this is a good long term solution.


Viewing 3 replies - 1 through 3 (of 3 total)
  • I just need to have this first parameter so set a global variable so I can modify the db requests, the rest part of the url should work the same wordpress is doing.

    We could say is the same functionality “language” is doing, adding a prefix to the url so you can determine language, but I don’t know how to implement that

    Hey @knskan3, have you achieved this issue already?

    I’m running a similar problem and I’ll be glad if you can help me with that.

    Today, my permalink looks like:

    And I want to:{dynamic based on %state% value}/%category%/%page%/

    Do you know what’s the solution for that issue?

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to WordPress dynamic url prefix based on taxonomy’ is closed to new replies.