Is there a way to limit search to post titles and contents? I tried below code in the link and its working but its just for titles. I would like to have function code for titles and contents. how to limit search to post titles?

  • 1
    Search is limited to title and content. What problem are you trying to solve here? Apr 30 at 9:56
  • 1
    By default, WordPress searches within the post title AND post content, which is exactly what you want. EDIT: Sorry, @JacobPeattie, didn't notice your comment here.
    – Abhik
    Apr 30 at 12:52
  • I have problem by default search For every word it doesn't work but when i use functions code its working i don't know what is the problem i tried to deactivate or delete plugin and theme and wordpress update automatically and manualy but problem still exists
    – mojtaba7b
    Apr 30 at 14:26
  • 1
    If you can't clearly articulate the problem you're not going to get useful help. Please carefully explain what the actual problem is. "For every word it doesn't work" doesn't mean anything. Apr 30 at 18:25


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.