Skip Navigation

[Resolved] Issues with URL encoding

This support ticket is created 5 years, 1 month 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 3 replies, has 2 voices.

Last updated by Craig 5 years, 1 month ago.

Assisted by: Nigel.

Author
Posts
#1418109

Hi there,
I am trying to troubleshoot an issue I am having with a URL which is being passed to another page which contains a contact form. The Loop I am using is below:-

<wpv-loop>
<div class="col-sm-4 staff-member search-results">
[wpv-post-featured-image size="custom" attr="class=image-size" width="156" height="208"]
[wpv-post-title output='raw']
<br />[types field="position" id=""][/types]
</div>
</wpv-loop>

The issue is when the Post Title (which is a persons name) contains an apostrophe, the URL returns a 403 Error.

I have tried adding output='sanitize' or output='raw' to the shortcode, but neither work. Is there a way to allow apostrophes to work in the URL?

The URL where the issue currently is – hidden link
The person in question is Yvonne O’Hara, all other links work OK.

Hope you can help.

Kind regards,
Craig

#1418179

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

You need to URL encode the title (which isn't an output option of the Views shortcodes), so you would likely need to create a custom shortcode for this.

You could create a specific shortcode to output the URL encoded title, or you could register a generic shortcode to encode whatever was within it, something like:

add_shortcode('urlencode', function ($atts = [], $content = null) {

    return urlencode( wpv_do_shortcode( $content ) );
});

which you could then use like:

[urlencode][wpv-post-title][/urlencode]
#1418187

Hi Nigel,

That is fabulous. Thank you so much for that.

Have a Merry Christmas!

Best regards,
Craig

#1418189

My issue is resolved now. Thank you!