This plugin hasn’t been tested with the latest 3 major releases of WordPress. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

Post-to-Post Links II


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

New in version 1.2: Support for custom post types

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.

You can also specify a named anchor 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.

For posts not yet published (pending, future, or draft) Post-to-Post Links II won’t try to link to them. Instead it shows the link text along with a note saying the post is not published yet (with both inside css classes if you want to style the appearance).

It is multi-site compatible.


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]

Get Help

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

Give Help

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


  • The modal dialog for selecting your link destination


Upload to your plugin folder just like any other plugin, and activate.

If you install the Extensible HTML Editor Buttons plugin, you will need to de-activate and re-active Post-to-Post Links II to enable its HTML editor button.


Please go to the Post-to-Post Links II page for more information.

Contributors & Developers

“Post-to-Post Links II” is open source software. The following people have contributed to this plugin.




Bug fix: get tag links working!


Added support for custom post types


Bug fix: the admin-ajax.php url resolution fix in 1.0.3 only worked when in the HTML editor; now also fixed for the Visual editor


For posts not yet published (pending, future, or draft) don’t link to them. Instead show the link text along with a note saying the post is not published yet (with both inside a css class for custom styling)


Bug fix: infer admin-ajax.php url from current url (the post edit page)


Bug fix: removed remaining calls to Toppa Libraries plugin


  • bug fix: provide relative URL for ajax request
  • bug fix: on activation, use is_plugin_active() to check whether we should register the p2p button with Extensible HTML Editor Buttons (the method check was throwing an error in some environments)


  • added visual editor button and dialog for finding posts
  • added support for highlighting text in the editor to make link text
  • added support for named anchors
  • refactored and added unit tests


  • made multi-site compatible


  • changed setLink setLink($atts, $content=null), adding $content parameter
  • overwrite $text=$content if $content was used
  • load element (post, category, tag)’s title everytime
  • for $type == ‘tag_id’, replaced database select by ‘get_term_by’
  • BUGFIX: $tag_id was being used outside of its scope, code was removed because it’s not needed anymore
  • created reportError, to report bad parameters
  • replace $wpdb queries for correspondent API functions in $type==’id’ and $type==’tag_id’
  • added some validation checks for when passed ip or slug is not found in database
  • added apply_filters() with tag ‘p2p_error_msg’, so that the message can be filtered as needed before it is sent to page


First version