Categories
Main

Hacking WordPress – Link In The Title (update 2)

As I have just figured out after some of the upgrades the external link in the title hack was, indeed, broken. In fact, I am somewhat puzzled, as it worked on some of my installations and didn’t work on others.

It turns out that the method of obtaining the permalink for the post is returning the canonical URI no matter what permalink system has been set up (I use custom on this blog). For example, even if you have something SEO-friendly, the code

$perm  = $post_id->guid;

would still return https://www.istudioweb.com/?p=427 as a link to this post. The right way of doing it now (before WP 2.7 arrives) is change the above line to:

$perm  = get_permalink($post_id);

That’s it. Should work.

P.S. Updated the downloadable txt file. Click here to view.