0

I don't want to use pre_get_posts.

           $args = array(
                //'posts_per_page'   => $posts,
                'post_type'        => 'post',
                'post_status'      => 'publish',
                'paged'            => $page,           
            );

Now I want to modify posts_per_page to do that I have done

$args['posts_per_page'] = 3,

Finally $query = new WP_Query($args); But no luck. Should I use pre_get_post?

1 Answer 1

1

You have php syntax error. Anyway you can both use

$args['posts_per_page'] = 3;

or

$args['posts_per_page'] = array('3');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.