• Resolved virgilio27

    (@virgilio27)


    I need to see 10 posts of each CPT actor each time, but this code doesn’t work. It get all the posts.

    Is it correct to use ‘posts_per_page’ => 10 ?

    $name = $post->post_name; //get the slug of the current CPT actors 
    $args = array(
    'post_type' => 'post',
    'posts_per_page' => 10,
    'meta_query' => array(array(
    	'key' => 'actors',
            'value' => $post->ID,
    	'compare' => 'IN',
    	),
    ),
    );
    
    $loop = new WP_Query($args)
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Post per page in Meta Query not working’ is closed to new replies.