Skip to main content
We are Brand SEO Beijing serving international business, your marketing partner, Contact us by mi@mgsh.com.cn

Website query article function query_posts()

The wordpress query article function query_posts() has a lot of parameters. Many netizens have various needs, but often do not know how to query articles according to the conditions they need, so we wrote this page to help netizens for the query_posts() function Generate parameters.
Example of usage: You need to query popular products by pageviews (assuming the pageview field name is post_view, and the product article type is product)
1. The article type I want to query is product
2. The name of the custom field I want to query is post_view, and the field type is unlimited.
3. I want to sort by custom field value in descending order
The following code generates parameters, copies the parameter array, and then uses query_posts($args); to query for posts.
For the time being, only parameters such as author, article type, publishing status, label, category, custom taxonomy, custom field, page number and quantity, and sorting can be provided.You can leave the items you don't need blank.

'post', 'post_status'=>'publish', 'posts_per_page'=>10, 'paged'=>1, 'orderby'=>'date', 'order'=>'DESC' ); ?>
Back to Top