Skip Navigation

[Resolved] How to create a View / Template to let visitors search by post ID

This support ticket is created 10 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 -
- - - - - - -

Supporter timezone: Europe/Madrid (GMT+01:00)

This topic contains 2 replies, has 2 voices.

Last updated by Alok Sharma 10 years, 5 months ago.

Assigned support staff: Caridad.



I am creating a sort of URL redirection site.

I want to create a View / Template to allow the visitors to search by post ID (numeric). If post ID is found, it will redirect the visitor to a URL stored in custom fields and if post ID is not found, then it will simply display a not found message.

I checked the tutorial over here but couldn't get much out of it. Any help will be highly appreciated.

Thanks in advance,



Dear Alok,

I dont think you can use frontend filters for this, because it works by filtering a set of results. You could put a form with an input somewhere (in a widget?) and add some code to functions.php in your theme to intercept it. I havent tried this, but if the input field is called 'uid', and the field is 'redirect-url', the code could be something like this:

add_filter('template_redirect', 'redirect_visitor');
function redirect_visitor() {
  if (!empty($_POST['uid'])) {
    $url = get_post_meta($_POST['uid'], 'wpcf-redirect-url', true);

Please let me know if there is anything else that I can assist you with.



Hi Caridad,

I really wish there was a provison in View to perform custom searches. But anyway, thanks a lot for the other peice of code.