WP-CLI Commands

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 setting
  • wp 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|deactivated> Gets list of users by status.
  • wp mem user get_pending Gets a list of pending users (when moderated registration is enabled).
  • wp mem user get_activated Gets a list of activated users (when moderated registration is enabled).
  • wp mem user get_deactivated Gets a list of deactivated users (when moderated registration is enabled).
  • wp mem user activate [--id=<user_id>] Activates the specified user ID, sends email by default (disable email to user with --notify=false).
  • wp mem user deactivate [--id=<user_id>] Deactivates the specified user ID.
  • wp mem user detail <username> [--all] Gets user meta for a requested user. --all lists all user meta, otherwise just WP-Members fields.