Modify Tag Permalinks to ignore location

This topic contains 7 replies, has 3 voices, and was last updated by  MC1171611 6 years, 4 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket

Tagged: , ,

  • Author
    Posts
  • #410855

    MC1171611
    Full Member
    Post count: 180

    Hi guys,

    I’m hoping to find a way to make the tags on listings link to the full tag listing, not the tags in that location. I have thousands of locations that have only one place/listing each, so linking to the tag for that location isn’t useful. Is this something that can be done?

    Thanks!

    #410905

    Guust
    Moderator
    Post count: 29970

    You can only change that by removing the location specific part of the permalinks at
    GD > Permalinks > Add location in urls >
    But that will change all URLs of your current listings too.

    #410948

    MC1171611
    Full Member
    Post count: 180

    Well that’s a bummer. Thanks for the response though.

    #410958

    Alex Rollin
    Moderator
    Post count: 27815

    Hello!

    Change Category and Tag links to remove the Location Filter

    Links for Categories and Tags on the Detail page will include the location of the listing. For example, the “Restaurant” Category link includes the location of the listing:
    https://MyGeodirectory.com/places/united-kingdom/northern-ireland/newcastle/restaurants/

    Use the following snippet to make the link for Categories and Tags point to the base page like:
    https://MyGeoDirectory.com/places/restaurants/

    The following Snippet will remove the filter that adds the location slugs to the Category and Tags taxonomy term URL on any page including Listing and Detail pages.

    
    
    
    remove_filter('term_link', 'geodir_get_term_link', 10);
    

    Add that snippet with the code snippets plugin:
    https://wpgeodirectory.com/docs/useful-plugins/#snippets

    This will apply to categories and tags both.

    For further customization, please contact a GD Expert at https://geodirectoryexperts.com

    #410990

    Guust
    Moderator
    Post count: 29970

    Alex’s snippet will indeed work. Sorry for my incorrect answer.
    And Alex, thanks for the tip 🙂

    #411011

    MC1171611
    Full Member
    Post count: 180

    That’s fantastic, thank you. Would it be better just to add to my functions.php file in my child theme? I’m running a ton of plugins and want to avoid adding another if possible.

    #411012

    Guust
    Moderator
    Post count: 29970

    Yes, you can add it to your functions.php.
    Code Snippets does not take anything to run, it just allows you to add snippets you would normally add to your functions.php independently of your theme.

    #411013

    MC1171611
    Full Member
    Post count: 180

    It works beautifully, thank you. That’s exactly what I was looking for. I use a ton of granular tags that should link to each other globally, not just within the location, so this is perfect. Thanks for the quick response!

Viewing 8 posts - 1 through 8 (of 8 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket