Support

Account

Home Forums Backend Issues (wp-admin) Relationship field not searching custom fields Reply To: Relationship field not searching custom fields

  • The search in the relationship fields uses the standard WP ‘s’ parameter for WP_Query http://codex.wordpress.org/Class_Reference/WP_Query#Search_Parameter. If you want to extend the query to also search custom fields then you’ll need to modify the query.

    I would start here https://www.advancedcustomfields.com/resources/acf-fields-relationship-query/

    And I’d take a look at at the parse_search() function in /wp-includes/query.php. It’s on line 2112 in the current version of WP.

    I’m not sure you can do this by just adding a complicated meta query. You may need to hook into where the query is done and alter it there, you may even need to build a completely custom query and to the db query yourself.

    There are some plugins available that will alter searches, one of them is https://wordpress.org/plugins/search-everything/, but I’ve seen this plugin cause a site with a lot of posts and custom fields to time out.