WordPress Search Syntax in URL for Custom Post Types

/WordPress Search Syntax in URL for Custom Post Types

WordPress isn’t exactly Google when it comes to searching. The system is long overdue an overhaul, but while we wait for the never-arriving necessity you can still get much more out of your WordPress searches.

Today a programmer client asked me something that I thought most WordPress developers would know without question:

How do I search a custom post type using the default WordPress /?s=

[searchterm] string in the URL bar?

The answer isn’t that difficult at all, but I’ll note it for reference. All you actually need is to add another variable to the URL, like so:


Voila! The ability to search custom post types and also create your own simple search box for them using the GET or POST variables in the URL.

2018-02-02T03:09:31+00:00January 25th, 2015|WordPress, WordPress Snippets|0 Comments

About the Author:

Warren Chandler is a freelance web programmer and web developer, based in Frinton on Sea, Essex. Warren specialises in web programming, web design, corporate identity, copy writing, SEO, logo and print media for home, work, and mobile platforms.

Leave A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.