Array Meta Query of a Custom Field ?How?
-
In the posts I have created a custom field called actors. Also have created a CPT called CPTactors and I have related it to the previous custom field bidirectionally.
Now I want that when I access the page of the CPT-actors I get a list of all the posts that actor has.
$name = $post->post_name; //get the slug of the current CPTactors $args = array( 'post_type' => 'post', 'posts_per_page' => 199, 'meta_query' => array(array( 'key' => 'actors', 'value' => $name, 'compare' => 'LIKE', ), ), ); $loop = new WP_Query($args) . . .
I’m trying this but nothing comes out. any ideas?
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Array Meta Query of a Custom Field ?How?’ is closed to new replies.