Use short codes to dynamically link to your WordPress pages and posts. All you need is the ID. This can come in handy when developing content for WordPress sites. Makes for a cleaner migration with no need to manipulate content when moving from one subdirectory or domain to another.
target are supported within the
[permalink] opening tag. See FAQs. You can insert the token
%post_title% to dynamically insert the post’s title into anchor text (content between the opening and closing shortcode).
A short code for
[template_uri] exists if you’d like to dynamically grab the full URL to your current template directory (useful for adding images and other resources bundled in a template via the page/post editor).
Example 1: Create link.
[permalink id=2 rel="internal"]Check out my latest post named %post_title%[/permalink] or use `[permalink]this link[/permalink]` to link to this post.
Example 2: Output Permalink URL.
<a href="[permalink]">;This post.</a>;
Example 3: Template Directory URI
<img src="[template_uri]/photos/me_grandma.jpg" alt="A Photo of Me and My Grandma" />
- Download and unzip to the ‘wp-content/plugins/’ directory
- Activate the plugin.
- I’ve got multiple permalinker short codes and it’s interpreting them incorrectly and not creating the anchor tags properly. What gives?
It is recommended that if you are mixing non-terminating short codes with terminating codes, that you change all non-terminating
short codes into terminating short codes with whitespace as the content:
[permalink] becomes `[permalink] [/permalink]`
Leading or trailing whitespace is trimmed off of any content within the permalinker short code tags.
- Can I add a class, rel, or target attribute to the permalinker output?
Yes. Simply add
targetattributes to the
[permalink]short code and they will be added to the resulting anchor element:
[permalink id="232" rel="related" target="_blank" class="highlight"]My favorite post[/permalink]
- Can I append a named anchor/ID/query string to the generated permalink?
Yes! Simply use the new
appendattribute (added in version 1.6):
[permalink id="232" append="#comments"]People are talking, talking 'bout people.[/permalink]
Contributors & Developers
“The Permalinker” is open source software. The following people have contributed to this plugin.Contributors
- Added ability to dynamically insert post_title into anchor text using the token %post_title%