0

I have a custom post type called "employees" (I'm using Custom Post Type UI plugin). I've created few posts of "employees" type. For getting link to post I'm using this code:

$original_permalink = get_permalink($original_post_id);
...
<a href="<?=$original_permalink?>‎"><?=RU_LINK?></a>

When I follow this link I get 404 error and URL like this: http://site.local/employees/lana/%E2%80%8E

I read that the reason is copy/paste of post title from MS Word or something like this, but I wrote titles manually. So this is not the reason. When I do code like this

echo $original_permalink = get_permalink($original_post_id);

I get correct URL. And when I see page code (Ctrl+U) it's correct too.

By the way, when I've created posts of default type ("post") such problems were not observed. What the reason for such behavior?

0

Mystic! I don't know why, but if I use code like this:

<?php
    $original_permalink = get_the_permalink($original_post_id);
?>

<a href="<?=$original_permalink?>‎"><?=RU_LINK?></a>

I get %E2%80%8E at the end of URL.

But if i use different names of variables my code works fine:

<?php
    $ru_link = get_the_permalink($original_post_id);
?>
<a href="<?=$ru_link?>"><?=RU_LINK?></a>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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