Skip Navigation

[Resolved] Adding URL parameter to link using post title doesn’t work

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to create a link that redirects to a post with a URL parameter. I would like to use the post title as the parameter value. When two posts have the same title, the URL parameter is not unique and WordPress redirects to the wrong URL.

Solution: Use the post slug in the URL parameter instead of the post title:

<a class="btn btn-primary" href="[wpv-post-url]?accommodation=[wpv-post-slug]" role="button"> special offer </a>
This support ticket is created 5 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by ralfS 5 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#1213801
toolset-wrong-url.jpg

Hello I have a problem again which I can not solve so.

I have a domicile and have View there with the corresponding accommodations. For this to be displayed I have a filter installed.

Posts in a Project Selecting Vacation Accommodation Relationships are a related to the current post in the loop.

As far as everything is fine.

Since the accommodation and the domicile I connected with Relationship. But if I click on the button "to offer" or I look at the URL, the link goes to another accommodation. The accommodation has the same name IRIS e.g. but is not linked to the displayed domicile. As a link, I built it that way
special offer

The problem only occurs if there are accommodations with the same name.

Here is the link for example
hidden link

The holiday apartment he would have to go to

hidden link

The link is closed
hidden link

Can you help me with how I can do other things?

Thank you

#1213824

What if you used the post slug instead of the post title in the link, like this:

<a class="btn btn-primary" href="[wpv-post-url]?accommodation=[wpv-post-slug]" role="button"> special offer </a>
#1214302

My issue is resolved now. Thank you!