WordPress.org

Ready to get started?Download WordPress

Forums

Getting Problem with the Search Box (2 posts)

  1. cyclopse
    Member
    Posted 1 year ago #

    hey guys i am running a website Awesome Moviez and in this when i search for something i get all result who have that search value but i want that only the titles of the post are being searched instead of whole content of the site... can any one help me out with this thanx in advance.

  2. bcworkz
    Member
    Posted 1 year ago #

    I'm guessing that search terms end up in the same general query that runs for nearly every other content page in WP. You'll need to confirm this, but even if wrong, the general concept stands, you'll just need a different hook.

    The WHERE portion of the search query contains a list of all posts table columns searched. You'll want to remove all but "post_title". You can access the WHERE terms of the general query by hooking the 'posts_where' filter.

Topic Closed

This topic has been closed to new replies.

About this Topic