How to limit search to post titles?

Posted by Prem Tiwari | Updated on

Here’s a filter that’ll do the trick. Drop it into your theme’s functions.php or a plugin.

Most of the code is just copied from the WP_Query class, except with the post_content LIKE’s removed.

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers