WordPress is: Themes, Plugins, Widget, Shortcode, PHP and GPL Licensed. Did you know that, beside Widgets, Another useful WordPress API is shortcode, and now I will show you how to added permalinks shortcode into our WordPress site. Why this shortcode is useful? because with permalinks shortcode The generated URL will be updated automatically, when original permalinks on page or post change.

How To Added Permalinks Shortcode
Let’s get started, write down permalinks shortcode functions on your functions.php in your current theme
function do_permalink($atts) {
extract(shortcode_atts(array(
'id' => 1,
'text' => "" // default value if none supplied
), $atts));
if ($text) {
$url = get_permalink($id);
return "<a href='$url'>$text</a>";
} else {
return get_permalink($id);
}
}
add_shortcode('permalink', 'do_permalink');
This code below using get_permalink() functions, it’s standard WordPress functions and created shortcode version with code above.
How to use permalinks shortcode? Follow this tutorial
<a href="[permalink id=49]">Basic Usage</a>
Or you can use this method too
[permalink id=49 text='providing text']
Thanks for DigWP for share this code, and I hope tutorial added permalinks shortcode is useful for your blog and more easy to added inlinks between your content (post or pages).
Please notes, this is only sample how we can make a good deal with WordPress shortcode. We can made more complicated shortcode if we need it.



That’s pretty cool thanks.
You are welcome…
awesome!!! ty
excellent , this is what I was looking for!!! thanks
Do you know of a plugin which will help me automatically change my slugs links because I’ve tried SEO post link, SEO slugs and more and can’t get it to do it on auto?
Pingback: WordPress Shortcode Best Practice « Post Your Content in PostFarm
Of course, my opinion is that free press release distribution sites (like ours) are the most effective ways at building links and bettering SEO.
This is great news for all blogger using wordpress.
WordPress 2.5 is otherwise called as Shortcode API which are small functions that helps us to create macro coding to post a content. Trivial shortcode looks like [gallery] and it is easy to create.
These permalinks require a lot more changes than suggested especially with wordpress. I really appreciate your efforts !
RE: Shortcode
Wp Tricks
Firstoff Thanks – also excuse my ignorance but is the same thing not achieved by altering the permalink structure in WP Admin?
Fantastic tutorial. Easy and understandable. Thanks.
I’m trying to create a simple shortcode to show the post ID in my post. Something like [post_id], can you help me with the function php code??? Thank you in advance!
Great, this is what I’ve been looking for. I’m creating a free theme for the moment and this was one of my problems! Solved! Thanks!
awesome, thanks
Is there a solution to a similar problem with images and/or called in files? Right now I’m working on a theme (in a test location on a sub directory) and I want to be able to link in my header to a .js file without needing to go back and change that. I’m having the same prob with ’s too.I hope this question wasn’t too far off topic.
Thank you for the useful read. keep on!
Thanks a lot!
i had use WP for years and never hear about the shortcode:(
Sorry if this is off topic but I am totally new to PHP / MySQL / Programming in general. Anyone know a good place to get started learning?
Web design is similar (in a very simplistic way) to traditional print publishing. Every website is an information display container,
Thanks for the step by step guide, now it will be easier for me to edit the short code on my wordpress hosted site.
Thanks for the info dude. You have shared the thing which i was searching for a very long time. I am going to add this short code to my blog. Thanks for the info. I hope you ‘ll share some other informative posts with us.
Hey thanks so much for this. Finally.
Thanks a lot!
i had use WP for years and never hear about the shortcode:(
Fantastic tutorial. This is great news for all blogger using wordpress installers.
I had a problem with permalinks, but when I upgraded to wp 2.9 it allows you to simply add in the desired format, which I got from the org site. They are great and this is helpful.
Pingback: Pide ya el Ubuntu 8.10: Intrepid Ibex
Do you know of a plugin which will help me automatically change my slugs links because I’ve tried SEO post link, SEO slugs and more and can’t get it to do it on auto? Thanks
Thank you! I’m teaching myself wordpress at the moment and appreciate the article.
Using Word Press we can made more complicated short code if we need it.
Hi,
thank you – i will try it today in a new Blog.
Do you know of a plugin which will help me automatically change my slugs links because I’ve tried SEO post link, SEO slugs and more and can’t get it to do it on auto
The plugins are very nice. They enhance the look of the wordpress. Thanks for the hard work
Thanks ive been wondering how to add these permalinks for ages!
thanks, will use it on my blog
Thanks for this excellent tutorial. Very easy to follow. Many thanks.
This is great news for all blogger using wordpress.
glad to see this tutorial, and ak hope to try it without any problems. thanks
This has great content for using wordpress.which are small functions that helps us to create.Its very easy to follow.
Thanks for this excellent tutorial. Very easy to follow. Many thanks.
A shortcode is a WordPress-specific code that lets you do nifty things with very little effort. Shortcodes can embed files or create objects that would normally require lots of complicated, ugly code in just one line.
Great, simple to follow article!
This looks great. I can’t wait to try it out.
thanks for the permalink shortcodes articles. It help me a lot
Fantastic Work..Hats off!!
i have tweak WP over 6 month..
but i don`t know this before.. thanks for sharing this dude
it`s help me a lot
I got the details about the shot code on word press.This was great article.
wow….but for wordpress.com or wordpress.org???
I got this update from WP Candy, StudioPress the first released Premium Theme I ever know merger with CopyBlogger LLC. [.....]
Thanks for tye useful code
There are so many useful WordPress API and with WordPress being so easy to install and uses there is really nothing better when it comes to care-free blogs. Kinda a set it and forget it type of blog engine.
One of the best shortcode tut’s I’ve seen in a while. Will be linking to it from my site!
Very nice! Thanks a lot. I modified it slightly to allow for multiple words in the link text. Separate words with _ and then use str_replace() to convert _ into spaces before outputting the final link.
wordpress is the best….the pulgins makes it better
I’ve tried to add permalinks shortcode into my WordPress site but just can’t get it to work properly. Maybe i need to do changes or just missing sth.
Permalinks shortcode is a great API, thanks for making its use clearer.
I think permalinks shortcodes definitely clean up the image of your wordpress blog. I have been so happy with wordpress!
Thanks, Enriched.
wordpress is the awesome… URL will be updated automatically!!! Nice.
This a new reason why wordpress is the best in the world…thanks !
Very intersting post. it’s look easy
I like this shortcode technique a lot and it’s given me a few ideas for expanding it.
This a new reason why wordpress is the best in the world…thanks !
I like this shortcode technique a lot and it’s given me a few ideas for expanding it.
Very nice! Thanks a lot. I modified it slightly to allow for multiple words in the link text. Separate words with _ and then use str_replace() to convert _ into spaces before outputting the final link.
Very nice! Thanks a lot.
Very nice! Thanks a lot. I modified it slightly to allow for multiple words in the link text. Separate words with _ and then use str_replace() to convert _ into spaces before outputting the final link.
Very Nice, Thanks, Enriched.
Great post, shortcode can be pretty confusing.
Thanks.
This a new reason why wordpress is the best in the world…thanks !
Thanks for the tip, i use it now for all my blogs and prestashop
I love your blog but your rss doesn’t works
Very nice! Thanks a lot. I modified it slightly to allow for multiple words in the link text. Separate words with _ and then use str_replace() to convert _ into spaces before outputting the final link.
Excellent writeup.I will bookmark this site. We are intending to sign up to this feed also.
Good tip, I like it and this is best tip of the day.