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 hidden
Displays 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 content
Displays the content settings for each post type.wp mem settings options
Displays 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 list
Lists 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--all
to activate all “pending” users, use--all --deactivated
to activate all users who are marked as deactivated.wp mem user deactivate [--id=<user_id>]
Deactivates the specified user ID. Use--all
to deactivate all users (skips admins), use--all --admin
to include admin users in the deactivate all action.wp mem user confirm
wp mem user unconfirm
wp mem user get-role
wp mem user get-user-by
wp mem set-membership
wp mem user detail <username> [--all]
Gets user meta for a requested user.--all
lists 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 membership
list – Lists available memberships with counts for all, active, and expired.wp mem membership list-count
wp 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-path
wp mem import activate
wp mem import deactivate
wp mem import confirm
wp mem import unconfirm
wp mem import memberships