How do I query a post in WordPress?
How do I query a post in WordPress? The two methods of querying posts You can query posts with either the function get_posts() or making a new instance of WP_Query. The first option returns an array of posts and in the second you handle an object. Because get_posts() returns an array of just the posts it's usually simpler to use this anywhere you'd like. How do I get all post data in WordPress? You have to use post_per_page='-1' to retrive all the posts. $args = array( 'post_type'=> 'post', 'orderby' => 'ID', 'post_status' => 'publish', 'order' => 'DESC', 'posts_per_page' => -1...