[Resolved] Limit "Search" to page titles

Home Forums Support [Resolved] Limit "Search" to page titles

Home Forums Support Limit "Search" to page titles

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1025952
    Michael

    Hi,
    Is there a simple snippet function I can add to limit the search functionality to only show page titles?
    My search is currently located in the footer.

    #1025972
    David
    Staff
    Customer Support

    Hi there,

    you can use the blog options filter:

    https://docs.generatepress.com/article/option_generate_blog_settings/

    The example provided applies to the search results page, just amend the options provided.

    #1028055
    Michael

    Hi David,
    I can’t seem to find the “only search on page titles”. And I am not quite sure if my footer search function is the same as the blog options settings.

    #1028248
    David
    Staff
    Customer Support

    Ah ok so you only want the search term to query the Post titles and not the content.
    In that case a user submitted function for that is available here:

    https://developer.wordpress.org/reference/hooks/posts_search/#user-contributed-notes

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.