Redirect URL to Post

Description

This plugin provides an URL that takes you directly to a post in single-post view. The post is determined by the query parameter ?redirect_to= and optional others. The URL will redirect to the first of all matching posts according to the chosen order.

You can simply enter the URL of your WordPress site into your browser and add ?redirect_to=… to the end. You can, of course, also use that URL in any link, in a menu, a button and so on. The plugin will recognize it and redirect the browser to the right post or page.

Possible values for redirect_to are:

  • last or latest – The URL will redirect to the last (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.

You can also limit the scope of considered posts by additional filter parameters, such as &s=searchaword or &cat=2.

The plugin also provides a shortcode [redirect_to_post_button] to create a simple button. Some parameters are available.

Examples for URLs

http://www.example.com/?redirect_to=latest – redirects to the latest post

http://www.example.com/?redirect_to=random&pk_campaign=random – redirects to a random post and tracks the visit

http://www.example.com/?redirect_to=random&date_query_after=1%20month%20ago – redirects to a random post among the posts that are not older than 1 month

http://www.example.com/?redirect_to=latest&exclude=4,7 – redirects to the latest post, excluding the posts with the IDs 4 and 7

http://www.example.com/?redirect_to=custom&orderby=comment_count&order=DESC – redirects to the post with the most comments

http://www.example.com/?redirect_to=latest&s=iaido&default_redirect_to=12 – redirects to the latest post that contains the word ‘iaido’ or, if nothing can be found, to the page or post with the ID 12

There is no settings page in the backend. You configure the plugin entirely through the query parameters in the URL.

Please find more information here.

If you find this plugin useful, please give it a 5-star rating. Thank you!

Follow us on Facebook or Twitter.

Installation

  1. Find the plugin in the list at the admin backend and click to install it. Or, upload the ZIP file through the admin backend. Or, upload the unzipped redirect-url-to-post folder to the /wp-content/plugins/ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.

documentation

FAQ

Installation Instructions
  1. Find the plugin in the list at the admin backend and click to install it. Or, upload the ZIP file through the admin backend. Or, upload the unzipped redirect-url-to-post folder to the /wp-content/plugins/ directory.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.

documentation

1. What if more than one post match the criteria (e.g. two have the same comment_count)?

There can be only one winner. The post that would be first in the list (as determined by WP) beats all others.

2. Since WordPress version 4.8, the shortcodes in the widgets stopped working correctly

That is a problem caused by the new editor in WordPress widgets. You can avoid it by using a text-only widget, like Classic Text Widget

3. The random parameter redirects always to the same post

You probably use a caching plugin or service that also caches query strings. Try adding an exception for the string “redirect_to=”. If you use Cloudflare, you can try their Page Rules.

4. Which URL can serve as the base?

Obviously only URLs of the WordPress blog where this plugin is installed.

5. Can I help translate?

Thank you! Please continue here.

Reviews

PERFECT

I needed a way to link to a random post and this plugin gave me exactly that.

Perfect and so simple

Just copy paste https://www.mywebsite.com/?redirect_to=random for my hyperlink and it rocks! Thank you. Very Good job.

I need just one feature, the possibility to exclude some pages such as privacy policy for instance. No interest to have this page in the lookup.

Read all 5 reviews

Contributors & Developers

“Redirect URL to Post” is open source software. The following people have contributed to this plugin.

Contributors

“Redirect URL to Post” has been translated into 1 locale. Thank you to the translators for their contributions.

Translate “Redirect URL to Post” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

0.6.5

OTHER

  • improved localization of onboarding message (sorry for displaying to existing users)
  • trying to improve localization

Older Versions

The complete changelog is available here.