Estimated reading time: 1 minute, 44 seconds

I’m big on WordPress, in fact, I’m using it for this site and most of the other sites that I’ve coded. Recently (when working on this blog) I decided that I wanted to generate the URL of the current page so that I could submit that specific page to social media sites, not just the root URL. I search everywhere but couldn’t find the solution that I was looking for and then it hit me.
If you want to dynamically generate the URL of the page/post that you are currently viewing then all you need to enter is:
This code generates and displays the current URL, which is great for submitting articles to Digg, Facebook, Twitter etc. etc.
What a big sigh of relief it was when I found that. The funny thing is that it’s been staring me in the face all along.
Various Codes to Generate Different URLs in WordPress
Below is a list of a number of variables used to generate various URLs using WordPress. The variable is on the left and the result is on the right.
admin_email = admin@example
atom_url = http:charset = UTF-8
comments_atom_url = http:comments_rss2_url = http:description = Just another WordPress blog
home = http:html_type = text/html
language = en-US
name = Testpilot
pingback_url = http:rdf_url = http:rss2_url = http:rss_url = http:siteurl = http:stylesheet_directory = http:stylesheet_url = http:template_directory = http:template_url = http:text_direction = ltr
url = http:version = 2.7
wpurl = http://example/home/wp
You can easily display this information by substituting the variable in the following code for the desired URL:
Did that help? Share your thoughts below!