Support

Account

Home Forums General Issues Search post by title of related post with relationship_field Reply To: Search post by title of related post with relationship_field

  • WP search, will search the title and content of a post (ie, post_title and post_content). As I said, it is impossible to search content of other posts.

    Not even paid plugins and services will search “related content”. The question is asked here a lot and there isn’t any CMS that exists where this can be done.

    Here are some alternatives:

    Using WP search it is possible to search custom fields of the same post by altering the WP query to look in these field. Plugins like https://wordpress.org/plugins/search-everything/ do this. But this means that you need the title of the related post in a custom field. This would mean that when saving the post (acf/save_post) you’d need to look at the relationship field and copy the title.

    Alternately, you could get the title of the related post when saved (acf/save_post) and put this into a hidden DIV in post_content. But this would get complicated because every time you’d first need to look at the content and delete whatever might be in the hidden DIV before updating it.

    You could build a custom search that has a select field to select filters to search by, for example to search for posts by an author that contains some content. This would be more complicated, but if you do a search you’ll find examples of this and even some tutorials for how to do it.

    If you want to search for what appears on the page on the front of the site without doing any work then you’re only choice is to use an app like google or some other 3rd party search tool that is meant for doing this type of search.