HOW TO GET ALL POST IN WORDPRESS QUERY

  • AUTHOR: // CATEGORY: WordPress, WordPress Plugin Development, WordPress Theme Development

    No Comments

    To get all the post in returned WordPress query results, you have to put: ‘posts_per_page’ => -1 in query arguments. For example:

    $all_posts = get_posts( array(
    	'post_type'	   => 'post', // e. g. custom_post_type
    	'orderby'          => 'post_date',
            'order'            => 'DESC',
    	'posts_per_page'   => -1,
    ) );
    
    LinkedInShare

    Comments

    comments

COMMENTS

0 Responses to How to Get All Post in WordPress Query

LEAVE A REPLY

FILL THE FIELDS TO LEAVE A REPLY. Your email address will not be published.