If you already have WP-CLI installed, you don’t need to do anything to use the WP-Members CLI commands – they are available when the plugin is activated. (Note that most hosts now include WP-CLI as standard, so you probably do not need to install it yourself.)
The following commands for the plugin are a subset of the wp mem command, which will display the sub commands available.
get
The get command allows you to run sub commands to “get” a number of different data elements:
wp mem get hiddenDisplays a list of posts marked as “hidden”wp mem get block_value --id=<post_ID>Gets the numeric value of the block settingwp mem get status --id=<post_ID>Gets the status of requested post (restricted, unrestricted, or hidden)
set
The set command allows you to set the status of specific post to restricted, unrestricted, or hidden.
wp mem set status --id=<post_ID> --status=<unblock|unrestrict|hide|block|restrict>
refresh-hidden
This command recalculates the post IDs in the hidden posts array.
wp mem refresh-hidden
settings
The following commands are a subset of the wp mem settings command, which will display the sub commands available.
wp mem settings contentDisplays the content settings for each post type.wp mem settings optionsDisplays the plugin’s option settings.wp mem settings enable <option>Enables the specified option.wp mem settings disable <option>Disables the specified option.wp mem settings pages listLists information for the login, register, and user profile page settings.wp mem settings pages clear [--all] [--login] [--register] [--profile]clears specified page settings (and use more than one option at a time).wp mem settings pages set [--login=<ID>] [--register=<ID>] [--profile=<ID>]sets specified page settings to the ID specified (can do more than one option at a time).
user
The following commands are a subset of the wp mem user command, which will display the sub commands available.
wp mem user list <pending|activated|deactivatedconfirmed|unconfirmed>Gets list of users by status.wp mem user activate [--id=<user_id>]Activates the specified user ID, sends email by default (disable email to user with--notify=false). Use--allto activate all “pending” users, use--all --deactivatedto activate all users who are marked as deactivated.wp mem user deactivate [--id=<user_id>]Deactivates the specified user ID. Use--allto deactivate all users (skips admins), use--all --adminto include admin users in the deactivate all action.wp mem user confirmwp mem user unconfirmwp mem user get-rolewp mem user get-user-bywp mem set-membershipwp mem user detail <username> [--all]Gets user meta for a requested user.--alllists all user meta, otherwise just WP-Members fields.
membership
The following commands are a subset of the wp mem membership command, which will display the subcommands available.
wp mem membershiplist – Lists available memberships with counts for all, active, and expired.wp mem membership list-countwp mem membership add <membership_meta_key> [--id=<user>]wp mem membership update <membership_meta_key> [--id=<user>]wp mem membership remove<membership_meta_key> [--id=<user>]
import
The wp mem import command will import users for action via a csv file.
wp mem import check-pathwp mem import activatewp mem import deactivatewp mem import confirmwp mem import unconfirmwp mem import memberships