WP-CLI Commands
The plugin registers a wp bpsp command family for managing sticky posts
from the shell. It is useful for bulk pin operations, migrations, cron
debugging, and quick status checks.
All commands live in includes/class-bpsp-cli-command.php under the
BPSP_CLI_Command class, registered as wp bpsp.
Pin an activity
Section titled “Pin an activity”# Pin sitewide as administratorwp bpsp pin 123 --scope=sitewide --as=admin
# Pin to a member's personal profile streamwp bpsp pin 456 --scope=personal --user=5 --as=user
# Pin inside a specific groupwp bpsp pin 789 --scope=group --group=10 --as=adminFlags:
| Flag | Values | Required | Notes |
|---|---|---|---|
--scope |
sitewide, personal, group |
yes | Which stream to pin into |
--as |
admin, user |
no (default: admin) |
Decides which quota applies |
--user |
integer | when scope=personal |
Profile owner’s user ID |
--group |
integer | when scope=group |
Group ID |
Quota enforcement runs through the shared bpsp_check_pin_quota() helper
— CLI cannot bypass the cap configured on the Permissions tab.
Unpin an activity
Section titled “Unpin an activity”wp bpsp unpin 123 --scope=sitewidewp bpsp unpin 456 --scope=personal --user=5wp bpsp unpin 789 --scope=group --group=10Flags:
| Flag | Values | Required | Notes |
|---|---|---|---|
--scope |
sitewide, personal, group |
yes | Which stream to unpin from |
--as |
admin, user |
no (default: admin) |
Role context for storage lookup |
--user |
integer | when scope=personal |
Profile owner’s user ID |
--group |
integer | when scope=group |
Group ID |
List pinned activities
Section titled “List pinned activities”# All pins across all scopeswp bpsp list
# Filtered by scopewp bpsp list --scope=sitewidewp bpsp list --scope=personal --user=5wp bpsp list --scope=group --group=10
# Output formatswp bpsp list --format=jsonwp bpsp list --format=csvwp bpsp list --format=countwp bpsp list --format=ids--format=ids outputs a space-separated list, useful for piping:
# Fetch the full activity object for every sitewide pinwp bpsp list --scope=sitewide --format=ids | xargs -n1 wp bp activity getScripting examples
Section titled “Scripting examples”Bulk-pin activities that carry a custom meta key
wp bp activity list --meta_key=is_announcement --field=id \ | xargs -I {} wp bpsp pin {} --scope=sitewide --as=adminCheck that the expiration cron is scheduled
wp cron event list --hook=bpsp_check_expired_sticky_postsbpsp_check_expired_sticky_posts is the hook registered in
includes/bpsp-expiration.php. On sites that have completed the DB
migration, a second variant bpsp_check_expired_sticky_posts_db also
runs hourly and is registered in includes/bpsp-functions-wrapper.php.
Manually trigger one round of expiry checks
wp cron event run bpsp_check_expired_sticky_postsRemove all sitewide pins that belong to deleted activities
for id in $( wp bpsp list --scope=sitewide --format=ids ); do wp bp activity exists $id || wp bpsp unpin $id --scope=sitewidedoneHow hooks behave with CLI
Section titled “How hooks behave with CLI”wp bpsp pin and wp bpsp unpin call the same bpsp_add_sticky_post()
and bpsp_delete_sticky_post() functions as the REST API and the browser
frontend. This means every documented action hook fires normally:
bpsp_after_pin_post, bpsp_user_pinned_activity, milestone hooks,
and activity log entries are all written. Gamification integrations
(GamiPress, myCRED, etc.) respond to CLI writes exactly as they respond
to browser writes.
Related
Section titled “Related”- Hooks & Filters — all actions that fire on pin/unpin.
- REST API — same operations over HTTP.

