A
A
art_y102020-06-09 10:50:15
WordPress
art_y10, 2020-06-09 10:50:15

WP Extended Search, how to add search in custom meta fields of custom taxonomy?

I am using the WP Extended Search plugin. For custom taxonomy, a custom metafield (textarea) with a visual editor has been added. The search plugin itself does not know how to search for custom meta fields in taxonomies.

I need to search in the texts of this custom taxonomy custom metafield.
I added a hook to the functions.php file of the theme, now in the search plugin settings I can select a custom meta field to search by (put a bird, search in this meta field):

function wpes_meta_keys_query($query) {
    global $wpdb;
    $query = "select DISTINCT meta_key from $wpdb->termmeta ORDER BY meta_key ASC";
    return $query;
}
add_filter('wpes_meta_keys_query', 'wpes_meta_keys_query');


But, in the frontend it still does not search. I suppose that you need to correct the query itself to the database (add a selection in the custom metafield of the custom taxonomy to the condition). But brains are not enough.

Main plugin file:

https://github.com/5um17/wp-extended-search/blob/m...

Plugin support page https://wordpress.org/support/plugin/wp-extended-s...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question