wordpress wp query posts & meta value
up vote
0
down vote
favorite
I have a cpt "members".
In a post I can select multiple members (object) via ACF in the specific post.
Now I want say: Please give me all posts where a member (e.g. nr. 76) ist marked in the post.
I try the whole day, and have no idea.
It's possible if i change the acf field to one number to get the correct posts, but Its important that I can select multiple members.
Thanks for helping!
sql wordpress advanced-custom-fields
add a comment |
up vote
0
down vote
favorite
I have a cpt "members".
In a post I can select multiple members (object) via ACF in the specific post.
Now I want say: Please give me all posts where a member (e.g. nr. 76) ist marked in the post.
I try the whole day, and have no idea.
It's possible if i change the acf field to one number to get the correct posts, but Its important that I can select multiple members.
Thanks for helping!
sql wordpress advanced-custom-fields
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a cpt "members".
In a post I can select multiple members (object) via ACF in the specific post.
Now I want say: Please give me all posts where a member (e.g. nr. 76) ist marked in the post.
I try the whole day, and have no idea.
It's possible if i change the acf field to one number to get the correct posts, but Its important that I can select multiple members.
Thanks for helping!
sql wordpress advanced-custom-fields
I have a cpt "members".
In a post I can select multiple members (object) via ACF in the specific post.
Now I want say: Please give me all posts where a member (e.g. nr. 76) ist marked in the post.
I try the whole day, and have no idea.
It's possible if i change the acf field to one number to get the correct posts, but Its important that I can select multiple members.
Thanks for helping!
sql wordpress advanced-custom-fields
sql wordpress advanced-custom-fields
asked Nov 10 at 19:29
Simone Westphal
64
64
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Finally got it :-)
$args = array(
'post_type'=>'post',
'numberposts'=> -1,
'meta_query' => array(
array(
'key' => 'members',
'value' => '76', //example
'compare'=>'LIKE'
)
)
);
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Finally got it :-)
$args = array(
'post_type'=>'post',
'numberposts'=> -1,
'meta_query' => array(
array(
'key' => 'members',
'value' => '76', //example
'compare'=>'LIKE'
)
)
);
add a comment |
up vote
0
down vote
Finally got it :-)
$args = array(
'post_type'=>'post',
'numberposts'=> -1,
'meta_query' => array(
array(
'key' => 'members',
'value' => '76', //example
'compare'=>'LIKE'
)
)
);
add a comment |
up vote
0
down vote
up vote
0
down vote
Finally got it :-)
$args = array(
'post_type'=>'post',
'numberposts'=> -1,
'meta_query' => array(
array(
'key' => 'members',
'value' => '76', //example
'compare'=>'LIKE'
)
)
);
Finally got it :-)
$args = array(
'post_type'=>'post',
'numberposts'=> -1,
'meta_query' => array(
array(
'key' => 'members',
'value' => '76', //example
'compare'=>'LIKE'
)
)
);
answered Nov 10 at 19:43
Simone Westphal
64
64
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242654%2fwordpress-wp-query-posts-meta-value%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown