Redirect URL to Post

Note: This plugin is provided for free. Particularly if you use it to make money or in a profit-making context, however, I would appreciate if you could make a donation. Thank you!




This WordPress plugin provides an URL that takes you directly to a single post, as specified by the query parameters. These parameters define how posts are sorted, and the URL will redirect to the post that would appear on top of the sorted list. While the URL remains unchanged, the destination of the redirection depends on the current post inventory.

Possible applications are:

  • Promote your latest post with one permanent link. Readers won’t have to go through a list – the link will take them directly to the full-page post.
  • Add a menu item that links to a random post.
  • Load the latest post that contains a certain phrase into a frame of another website.
  • Link to the latest post that was published in any January or in a particular category.
  • Increase page views by displaying a button or menu to call random posts.

The plugin does not offer any settings in the admin back end.


Add the query parameter redirect_to to the URL of your blog. Values can be:

  • last or latest – The URL will redirect1 to the latest post.
  • first or oldest – The URL will redirect to the first (oldest) post.
  • random – The URL will redirect to a random post.
  • custom – The post will be determined according to the mandatory parameter orderby and the optional parameter order. Possible values for orderby are listed here. By default, order is “DESC” (descending – starting from the highest value, the later time or the bottom position in alphabetic order). Alternatively you can set it to “ASC” (ascending).

Obviously, the parameter “custom” lets you achieve the same as “latest”, “first” and “random”. These shortcuts exist just for convenience and readability.

You can combine them with other standard queries in order to limit the considered posts to a certain group. Supported are (according to superficial testing):

author, author_name, cat2, category_name, day, exclude3, hour, minute, monthnum, order, orderby, post_type4, s5, second, tag, w6, has_password, tag_id

The default value of post_type is “post”.

You can also add a parameter default_redirect_to where you can specify a default destination if the other criteria returns an empty result. It accepts as value the id of a post or page. If this parameter is omitted or if the post or page with this id cannot be found, then the default destination is the home page.

Since version 0.5, you can also add parameters for tracking redirects in your statistics. Supported are Google Analytics (utm_sourceutm_campaign and utm_medium) and Piwik (pk_campaign and pk_kwd).


Redirect to a random post

Redirect to the latest post in the category “Software”

Redirects to the oldest post, excluding the posts with the IDs 4, 7 and 35,7,35

Redirect to the post with the highest comment count

Redirect to the oldest post that contains the word “nishio”

Redirect to a random post and track the visit

Shortcode to create button

Since Version 0.5, you can create a button with a shortcode.  The syntax is:


Possible parameters are:

div_class: Class name used for the enclosing div.
Class name used for the button.
text: Button text. Default: “Random Post”
redirect_to: Sets the query parameter. Default: “random”
params: Additional parameters. Formatted as: “key1=>value1,key2=>value2, …”

You can, of course, create your own button, link or menu and just manually set the URL.


At the WordPress plugin repository.


If you have any question or problem, please proceed to the WordPress Support Forum.

Tip Jar

Yes, this plugin is free but it takes much effort to maintain it. Please donate to this charity or below to the author:

qr-btc-plugins-newBitcoin: 1Fe21r57vDK56Yy2MbwjEoTVMiLefpV1v

If you travel, please book your hotel via this link so that I will get a percentage.
If you find this plugin useful, I would also appreciate a five-star-rating.


Show 6 footnotes

  1. Technically the URL is rewritten, i.e. the browser address bar will show the new URL.
  2. ID or comma-separated list of IDs
  3. comma-separated list of post or page IDs
  4. requires has_archive for that post_type
  5. Search for a keyword
  6. Week of the year

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *