Answer the question
In order to leave comments, you need to log in
How to get products in the name of which there is a string?
I get products in this way, but sorting by name does not work, by category of the day and the set works, how can I fix the search by name?
$query = new WP_Query( [
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => -1,
'tax_query' => [
'relation' => 'AND',
[
'name__like'=> $product_name,
],
[
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array('nabor'),
],
[
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => $day,
],
]
] );
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question