Post-to-Post Links II – A WordPress plugin for easy linking within your site

I am currently no longer developing or supporting my WordPress plugins. I may resume development and support in the future, but I’m not sure when.

Post-to-Post Links II lets you easily create a link to another post, page, tag, or category on your site. With a dialog form that uses autocomplete to look up posts by title, it’s very easy to find your link destination. The link will automatically use the title of the post, page, tag, or category as the link text, or you can supply your own link text.

It generates a shortcode instead of an HTML link. This means your links won’t break if you ever change your permalink structure, or change the organization of your categories.

Post to Post Links II screenshotPost to Post Links II screenshot
Post to Post Links II screenshot19-Jan-2013 17:16

You can also specify a named anchor target for the link, and enter any additional attributes you need (such as an “id” or “name” for use with javascript or css).

It includes a button for the visual editor to launch the dialog form for looking up posts. If you prefer the HTML editor, you can install my Extensible HTML Editor Buttons plugin, and Post-to-Post Links II will use it to register a button in the HTML editor button bar.


A simple link to the “Hello World” post:

[p2p type="slug" value="hello-world"]My first post[/p2p]

A link to a category page that opens in a new window:

[p2p type="category" value="around-the-world" attributes="target='_blank'"]Read about my trip around the world[/p2p]

A link to a named anchor on a page:

[p2p type="slug" value="hello-world" anchor="more"]My first post[/p2p]

Handling Unpublished Posts

For links to posts that are not yet published (i.e. posts with a draft, future, or pending status) the link text will appear in italics, without a link, followed by a note. They have css classes assigned if you wish to style them. Here is an example if you wish to apply your own styling:

<i class='p2p-pending-link'>link text for a post not yet published</i> <i class='p2p-pending-note'>[the linked post is not published yet]</i>

Get Help

Enter a post in the support forum for Post to Post Links II, and I’ll respond there.

Give Help

Shortcode Attributes

  • type: can be “slug” (for a post or page), “category”, or “post_tag” (for tags)
  • value: the slug of the linked post, page, category, or tag (with the dialog form this is entered for you automatically, after you look up the post, category, or tag by title)
  • text (optional): provides text for the link (if you leave it out, the title of the post, tag, or category will be used).
  • attributes (optional): allows you to provide any other attributes you’d like for the link, such as a target, title, onclick, etc. Note that you need to use single quotes here, since the value itself is delimited by double quotes.
  • anchor (optional): a named anchor on the page you want to link to.

If for any reason you prefer to type the shortcode by hand instead of using the dialog form, there is a shorthand for it. Instead of using “type” and “value”, you can use any of the types as an attribute, for example [p2p slug=”hello-world”[.

This plugin was inspired by the Post-to-Post Links plugin written (but no longer maintained by) Scott Reilly.

2 thoughts on “Post-to-Post Links II – A WordPress plugin for easy linking within your site

  • Hi there, I have been a loyal user of this plugin for several years on a very large media website. I just updated to the new version of wordpress and THOUSANDS of tag links I have created over many very important posts are now broken and showing up as incorrect error coding. The damage is reprehensible. I carefully chose this plugin specifically so I would not have an issue with broken links and now it has created a problem I don’t think I can personally fix! For years it has worked beautifully and now I am left in a very serious bind. Is there anything I can do to recover all of this lost work? I am extremely concerned and need to remedy this problem ASAP. As I mentioned, we are a news media site, we have daily posts and updates. This is a major setback. Please advise.

    • Fixed this by replacing line 201 in Post2Post.php.
      if (!is_a($term, ‘stdClass’)) {
      replaced with:
      if (!($term instanceof stdClass)) {

Leave a Reply to Rachel Henley Cancel reply