I need to display only the last 3 posts but i get 10 posts (Reading Settings).

Any idea ?

<?php
$args = array( 'post_type' => 'post', 'posts_per_page' => 3);
$wp_query = new WP_Query($args);
while ( have_posts() ) : the_post(); ?>

            <h4>
                <a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
            </h4>
            <?php the_excerpt(__('(more…)')); ?>

<?php endwhile; ?>
<?php wp_reset_postdata(); ?>

Read more here: WP_query : Force last posts number over Reading Settings


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: