Top 10 v3.0.0 introduced Top_Ten_Query, which works as a wrapper for WP_QueryOpens in a new window. This brings all the power and flexibility of WP_Query to Top 10. If you’re not familiar with WP_Query, I recommend reading the documentationOpens in a new window.
Standard Loop
get_tptn_posts()
get_tptn_posts() is a wrapper to Top_Ten_Query. You can use it to retrieve an array of the popular posts. It also accepts the same $args as Top_Ten_Query.
Parameters
In addition to the WP_Query parametersOpens in a new window, Top_Ten_Query also takes these additional parameters.
| Parameter | Type | Description |
|---|---|---|
blog_id | array or string | Array or comma-separated string of blog IDs. |
daily | bool | Set to true to fetch daily or custom period posts. Set to false for the overall popular posts. |
daily_range | number | Enter the number of days, e.g. set it to 7 to fetch the popular posts in the past week. |
include_cat_ids | array or string | Array or comma-separated string of categories or term_taxonomy_ids. |
include_post_ids | array or string | Array or comma-separated string of post IDs to include. |
offset | int | Offset the related posts returned by this number. |
strict_limit | bool | If false, fetches up to 3× the limit to allow filtering. |




