• hi guys
    i wrote this code for my template but i have problem.
    here is my code:

    <?php
    $cat_id = get_cat_ID( single_cat_title("",false) );
    global $post;
    $args = array(
      'post_type' => 'post',
      'posts_per_page' => 6,
      'category' => $cat_id,
      'tax_query' => array(
        array(
          'taxonomy' => 'post_format',
          'field' => 'slug',
          'terms' => 'post-format-image',
          'operator' => 'NOT IN',
        ))
    );
    $myposts = get_posts( $args );
    foreach( $myposts as $post ) :  setup_postdata($post);
      the_title( '<h4>', '</h4>' );
    endforeach;
    ?>

    unfortunately posts_per_page not working 🙁

    [Moderator Note: No bumping, thank you.]

The topic ‘posts_per_page not working in get_posts’ is closed to new replies.