Answer the question
In order to leave comments, you need to log in
How to specify an additional field in WP_Query?
Hello, you need to make a request in WP_Query for an additional field in which the array.
Request
$id = 3;
$param = array(
'post_type' => 'courses',
'order' => 'DESC',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => 'teachers',
'value' => $id,
'compare' => 'LIKE',
),
),
);
[0] => Array
(
[ID] => 3
[user_firstname] => Владимир
....
),
[1] => Array
(
[ID] => 4
[user_firstname] => Александр
....
)
Answer the question
In order to leave comments, you need to log in
This will not work.
You need to display all the values \u200b\u200bof "courses", and then do foreach array meta and check the ID.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question