Recent

Popular_Posts_CommandclassPro only

Popular posts commands for Top 10.

EXAMPLES

# Get top 10 popular posts
$ wp top10 popular

# Custom period popular posts for the last 7 days
$ wp top10 popular --daily --days=7

# Limit to 5 posts, CSV output
$ wp top10 popular --limit=5 --format=csv

# Filter by multiple post types
$ wp top10 popular --post-type=post,page

# Custom period between specific dates
$ wp top10 popular --daily --from-date=2025-01-01 --to-date=2025-01-31

# Exclude categories and limit post age
$ wp top10 popular --exclude-categories=5,12 --how-old=30

Namespace: WebberZone\Top_Ten\Pro\CLI
Since: 4.3.0
Source: includes/pro/cli/class-popular-posts-command.php line 44 Extends: Base_Command

Methods

__invoke()

Get popular posts.

OPTIONS

[–limit=] : Number of posts to return. Default: 10.

[–daily] : Show custom period popular posts instead of overall.

[–days=] : Number of days for the custom period. Default: from plugin settings.

[–from-date=] : Start date for the custom period (YYYY-MM-DD). Only used with –daily.

[–to-date=] : End date for the custom period (YYYY-MM-DD). Only used with –daily.

[–how-old=] : Limit posts to those published within this many days.

[–post-type=] : Post type or comma-separated list of post types. Default: all public post types.

[–include-cat-ids=] : Comma-separated list of term_taxonomy_ids to include.

[–exclude-categories=] : Comma-separated list of term_taxonomy_ids to exclude.

[–include-post-ids=] : Comma-separated list of post IDs to force-include.

[–offset=] : Number of posts to skip. Default: 0.

[–author=] : Filter by author ID or comma-separated list of author IDs.

[–blog-id=] : Blog ID or comma-separated list of blog IDs (multisite only).

[–format=] : Output format (table, json, csv, yaml, ids, count). Default: table.

EXAMPLES

wp top10 popular
wp top10 popular --daily --days=7 --limit=5
wp top10 popular --post-type=post,page --format=csv
wp top10 popular --daily --from-date=2025-01-01 --to-date=2025-01-31
wp top10 popular --exclude-categories=5,12 --how-old=30
wp top10 popular --author=1,2 --format=json

Line: 105

public function __invoke( array $args, array $assoc_args ): void;
Type Name Description
array $args Command arguments.
array $assoc_args Command associative arguments.

Returns: void