0

I am using a shortcode to call some posts with a permalink using non Latin characters.

However the urls get percent encoded ( showing up as %20%regfd etc) What is the best way to make sure urls are decoded in the front?

I noticed then adding some space before the link, the urls also shows up decoded. But I don't think this is the best solution.

<a href=" '.$url.'">

Thanks in advance!

1 Answer 1

0

It makes sense to look at the PHP function rawurldecode, which decodes URL-encoded strings. https://www.php.net/manual/en/function.rawurldecode.php

For example, echo rawurldecode(get_permalink($post->ID)); will show the decoded post URL. But this isn't really needed in hyperlink code.

Sorry I didn't just write a comment, I don't have enough points for that option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.