Skip to content

WP-CLI

To try SpaceBay or build a demo site, add sample spaces, members, topics, posts, comments and likes with WP-CLI:

Terminal window
wp spacebay demo
wp spacebay demo --remove

It adds 7 spaces (reusing spaces you already have with the same names), 24 members, 23 posts with comments, replies and likes, a member waiting for approval, a join request, a reported post, two private chats with the first administrator, and five events (four coming up, one past) with answers. It refuses to run twice. Sample members get addresses ending in example.invalid and cannot receive email, and no notifications are sent. --remove deletes exactly what the command added.

Every step of Import and export also works from the command line. This suits big sites and servers with short web time limits.

Terminal window
wp spacebay export <space|spaces|members|full|members-csv> [options]
wp spacebay import <file-or-folder> [options]
wp spacebay import-remaps <transfer-id> [--out=<file>]

The scope is one of space, spaces, members, full or members-csv (the members list as a CSV file).

OptionMeaning
--space=<slug or id>The space to export (scope space), or a comma-separated list (scope spaces; leave it out for all spaces).
--out=<file>Where to write the zip. The default is a generated name in the current folder. The file must not exist yet.
--dir=<folder>Write an unpacked export folder instead of a zip. The folder must not exist or must be empty. Use either --out or --dir, not both.
--no-mediaLeave out pictures and files.
--no-messagesLeave out private chats (scope full). Without this option, a full export from the command line includes them.
--no-membersLeave out memberships (scopes space and spaces).
--no-contentLeave out posts, comments, events and points (scopes space and spaces).
--structure-onlyExport only the space settings, groups and topics (scopes space and spaces).
--social-linksInclude the social links members put on their profile.
--include-secretsInclude sign-in app IDs and secrets. Keep the file private. Needs --yes.
--yesConfirm --include-secrets.
--status=<list>members-csv only. Account states to include, comma-separated: active, pending, blocked. The default is active.
--hidden-detailsmembers-csv only. Keep the profile details of members who hid their profile. Without it they are blank.
Terminal window
wp spacebay export full --out=community.sbx.zip
wp spacebay export space --space=general --dir=/tmp/general-export

The file is a .sbx.zip file or an unpacked export folder. Without --dry-run, the command plans the import and then runs it to the end in the chosen mode.

OptionMeaning
--mode=<mode>merge (the default), new or replace.
--dry-runOnly plan the import and show what it would do.
--report=<file>Write the full plan report as JSON to this file.
--choices=<json>What to do with spaces whose address is taken, for example {"spaces":{"12":"merge","15":"skip"}}.
--apply-settingsIn merge mode, also plan the settings of the file.
--keep-moderatorsGive new members who were site moderators in the file the moderator role here.
--email-new-membersSend new members a welcome email with a link to set their password.
--award-pointsAward points for the imported posts, comments and likes.
--leave-out-unsupportedLeave out what this version cannot import (data of an add-on, for example) instead of stopping.
--leave-out=<list>Also leave out these, comma-separated: settings, reports, redirects, messages.
--import-secretsApply the sign-in secrets of the file too. Only a file exported with --include-secrets has them.
--merge-chatsWhen two members already have a direct chat here, add the imported messages to it instead of skipping that chat.
--yesGo on when the dry run says some data of the file will be left out.
--confirm-privileged-matchesGo on when members of the file match accounts that manage this site (the same email address). The dry run names them. --yes does not cover this.
--confirm=<name>Replace mode only: the name of this community, or replace when it has none.
Terminal window
wp spacebay import community.sbx.zip --dry-run --report=plan.json
wp spacebay import /tmp/general-export --dry-run --mode=new
wp spacebay import community.sbx.zip --email-new-members

There is no undo command. Undo a Merge or New import on the Import and export screen.

Writes the list of rows an import gave a new ID or address, as CSV. Take the transfer ID from the Import and export screen.

Terminal window
wp spacebay import-remaps 42 --out=remaps.csv

Without --out the CSV is printed on the screen. With --out the file must not exist yet.

This lists the addresses that the community and something else on the site both use: a page, a post, a post type archive, a post type base address or a rewrite rule. Use it before you choose At the home address in Community home location, or to check the site after a plugin or theme change. The command always checks live, whether the setting is on or off.

Terminal window
wp spacebay portal clashes
wp spacebay portal clashes --format=json
OptionMeaning
--format=<format>table (the default) or json.

The table has the columns address, kind, source, detail and edit_url. kind is page, post, rule, archive or post_type. When there is no clash, the table format prints a short message that says so.

With SpaceBay Pro, you can see how a member logs in and reset their two-factor setup:

Terminal window
wp spacebay two-factor status <user>
wp spacebay two-factor reset <user>

See Two-factor authentication.