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.

Leave a Reply