Popular_Posts_Command
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/cli/class-popular-posts-command.php line 41
Extends: Base_Command
Methods
__invoke()
Get popular posts.
OPTIONS
[—limit=
[—daily] : Show custom period popular posts instead of overall.
[—days=
[—from-date=
[—to-date=
[—how-old=
[—post-type=
[—include-cat-ids=
[—exclude-categories=
[—include-post-ids=
[—offset=
[—author=
[—blog-id=
[—format=
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: 102
public function __invoke( array $args, array $assoc_args ): void;
| Type | Name | Description |
|---|---|---|
array | $args | Command arguments. |
array | $assoc_args | Command associative arguments. |
Returns: void