All tags
Start here · wp-cliBack up WordPress with WP-CLI before every update, and test that it restores9 steps · 11 min read · WordPress site owners with shell accessStart the guide wp-cli
Narrow down
Guides1
Web59
- Tip
wp widget list <sidebar-id>wp widget list shows the widgets in a sidebarLists the widgets placed in one sidebar, with their ID and position.2 Dec 2026 - Tip
wp sidebar listwp sidebar list shows the sidebars your theme registersLists the registered sidebars with their IDs, which you need for other widget commands.2 Dec 2026 - Tip
wp taxonomy list --format=csvwp taxonomy list shows every taxonomy your site registersLists registered taxonomies, optionally only those that belong to one post type.2 Dec 2026 - Tip
wp super-admin listwp super-admin list shows who has super admin rightsLists the users with super admin capabilities on a WordPress multisite install.2 Dec 2026 - Tip
wp cli check-updatewp cli check-update tells you when the WP-CLI behind your WordPress is oldChecks for a newer WP-CLI release and updates the phar after you confirm.30 Nov 2026 - Tip
wp theme delete --allwp theme delete with the all flag clears out unused WordPress themesRemoves every theme except the active one, so old themes stop waiting for updates.30 Nov 2026 - Tip
wp media image-sizewp media image-size lists every thumbnail size WordPress createsShows the registered image sizes with width, height and crop, so you see what each upload costs.30 Nov 2026 - Tip
wp comment list --status=hold --fields=comment_ID,comment_author,comment_contentwp comment approve clears the WordPress moderation queue in one commandApproves all pending comments at once after you have checked the list.30 Nov 2026 - Tip
wp core update-db --dry-runwp core update-db finishes a WordPress update the dashboard is waiting forRuns the database upgrade step after new core files, with a dry run to check first.30 Nov 2026 - Tip
wp db cliwp db cli opens a MySQL prompt for the WordPress databaseOpens an interactive MySQL client already logged in to the site's database.30 Nov 2026 - Tip
wp post create ./draft.html --post_title='Release notes' --post_status=draft --porcelainwp post create reads the WordPress post body from a filePublishes or drafts a post whose content comes from an HTML file on disk.30 Nov 2026 - Tip
wp core version --extrawp core version with the extra flag shows the WordPress database revision tooPrints the WordPress version plus database revision, TinyMCE version and package language.30 Nov 2026 - Tip
if wp plugin is-active woocommerce; thenWp plugin is-active gives a WordPress script a yes or noChecks whether one plugin is active and answers with exit code 0 or 1.30 Nov 2026 - Tip
wp user set-role anna authorwp user set-role changes what a WordPress account may doGives a user one new role and removes the roles the account had before.30 Nov 2026 - Tip
if ! wp core is-installed 2>/dev/null; thenWp core is-installed lets a script check for WordPress by exit codeReturns success when WordPress is installed, so a deploy script can branch on it.30 Nov 2026 - Tip
wp core download --skip-content --locale=nl_NLwp core download with skip-content fetches WordPress without the default themesDownloads a clean WordPress core in the language you want, without bundled themes and plugins.30 Nov 2026 - Tip
wp import site.wordpress.2026-11-30.000.xml --authors=createwp import loads a WordPress WXR file and maps the authors for youImports an export file from the terminal and creates or maps the post authors.30 Nov 2026 - Tip
wp cap list editor | sortwp cap list shows exactly what a WordPress role is allowed to doPrints the capabilities of a role so you can see what editors or shop managers may do.30 Nov 2026 - Tip
wp term list post_tag --fields=term_id,name,slug,countwp term list shows every WordPress category or tag with its post countLists the terms of a taxonomy with ID, slug and how many posts use each one.30 Nov 2026 - Tip
wp plugin list --debugThe debug flag shows why a WP-CLI command on WordPress failsPrints every PHP error and the steps WP-CLI takes while loading the site.30 Nov 2026 - Tip
wp db columns wp_postmetawp db columns shows the structure of a WordPress tableLists every column of a table with its type, key and default value.30 Nov 2026 - Tip
wp post-type list --fields=name,label,public,hierarchicalwp post-type list shows which content types a WordPress site hasLists every registered post type, including the hidden ones plugins add.30 Nov 2026 - Tip
wp i18n make-pot . languages/my-plugin.potwp i18n make-pot builds the translation template for a WordPress pluginScans a plugin or theme for translatable strings and writes a POT file.30 Nov 2026 - Tip
wp post generate --count=50wp post generate fills a WordPress test site with dummy postsCreates any number of placeholder posts or pages to test a theme or a query.30 Nov 2026 - Tip
wp db query 'SELECT option_value FROM wp_options WHERE option_name="home"' --skip-column-nameswp db query runs SQL with the credentials from wp-configRuns a SQL query against the WordPress database without needing the database password.28 Nov 2026 - Tip
wp db search example.comwp db search finds a string anywhere in the WordPress databaseSearches every WordPress table for a string or regex and shows the table, column and row.28 Nov 2026 - Tip
wp db optimizewp db optimize defragments the WordPress tablesDefragments the WordPress database tables after a big cleanup using the credentials in wp-config.28 Nov 2026 - Tip
wp user list --role=administrator --fields=ID,user_login,user_email,user_registeredwp user list --role=administrator shows who can do everythingLists every administrator account of a WordPress site with only the columns you pick.28 Nov 2026 - Tip
wp user session destroy admin --allwp user session destroy --all logs one account out everywhereEnds every login session of one WordPress account so old logins stop working.28 Nov 2026 - Tip
wp plugin list --status=active --field=name > active-plugins.txtwp plugin deactivate --all finds the plugin that breaks your siteSwitches off all WordPress plugins at once so you can find which one breaks the site.28 Nov 2026 - Tip
$ids = get_posts( array( 'post_status' => 'draft', 'fields' => 'ids', 'numberposts' => -1 ) );Wp eval-file runs a PHP script inside WordPressRuns a PHP script file with WordPress fully loaded, passing extra arguments in $args.28 Nov 2026 - Tip
wp rewrite list --format=csvwp rewrite list prints the rewrite rules WordPress usesPrints the WordPress rewrite rules and lets you see which one matches a given URL.28 Nov 2026 - Tip
wp option pluck my_plugin_settings api timeoutwp option pluck reads one value from deep inside a WordPress optionPrints a single nested value from a WordPress option without dumping the whole array.28 Nov 2026 - Tip
wp cli infowp cli info shows which PHP and config files wp is really usingShows the PHP binary, php.ini, memory limit and config files that WP-CLI is using.28 Nov 2026 - Tip
wp config list WP_DEBUGwp config list prints what wp-config.php defines, with a filterLists constants and variables from wp-config.php, optionally filtered by name.28 Nov 2026 - Tip
wp role listwp role list shows the roles a WordPress site hasLists every role on a WordPress site, including any that plugins added.28 Nov 2026 - Tip
wp post meta list 123wp post meta list shows every custom field of one postPrints all custom fields (post meta) of a single post, optionally filtered by key.28 Nov 2026 - Tip
wp media import /tmp/photos/*.jpg --post_id=123 --alt="Leiden in the snow"wp media import puts a folder of images in the WordPress media libraryAdds images from a folder or URL to the WordPress media library without the browser.27 Nov 2026 - Tip
wp plugin install my-plugin --version=2.4.1 --forcewp plugin install --version --force rolls a WordPress plugin backPuts an older version of a WordPress plugin back after an update breaks something.27 Nov 2026 - Tip
wp option get blog_publicSearch engine visibility in WordPress asks Google to skip a site, and that's all it doesAsks search engines not to index a WordPress site, without blocking anyone from visiting it.27 Nov 2026 - Tip
wp comment delete $(wp comment list --status=spam --format=ids) --forcewp comment delete with --status=spam empties the WordPress spam folder in one goDeletes every comment in the WordPress spam folder permanently with one WP-CLI command.27 Nov 2026 - Tip
wp plugin auto-updates status --allwp plugin auto-updates enable turns on WordPress auto-updates per pluginSwitches WordPress plugin auto-updates on or off from the command line, per plugin or all.26 Nov 2026 - Tip
wp maintenance-mode activatewp maintenance-mode puts your site on hold during a big changeTurns WordPress maintenance mode on and off from the command line.25 Nov 2026 - Tip
wp config shuffle-saltswp config shuffle-salts logs everybody out after a break-inReplaces the keys and salts in wp-config.php so every existing WordPress login session becomes invalid.18 Oct 2026 - Tip
wp option list --autoload=on --format=total_byteswp option list --autoload=on --format=total_bytes shows what every page load drags alongShows how many bytes of WordPress options load on every page request, and which ones are biggest.4 Oct 2026 - Tip
wp plugin list --skip-plugins --skip-themes–skip-plugins and --skip-themes get WP-CLI working on a broken siteLets WP-CLI run on a crashing WordPress site by not loading plugins or themes, so you can fix it.26 Sep 2026 - Tip
wp media regenerate --only-missing --yeswp media regenerate --only-missing fixes images after a theme changeCreates only the missing image sizes after a theme change instead of redoing every thumbnail.20 Sep 2026 - Tip
wp transient delete --expiredwp transient delete --expired cleans the leftovers out of your options tableRemoves expired cached values from the WordPress database without touching the ones still in use.22 Aug 2026 - Tip
wp config set WP_DEBUG true --rawwp config set WP_DEBUG true --raw edits wp-config.php without opening itSets a constant in wp-config.php as a real true or false value, without hand-editing the file.1 Jul 2026 - Tip
wp plugin verify-checksums --allwp plugin verify-checksums --all checks every plugin against WordPress.orgChecks the files of every installed plugin against WordPress.org and lists any that do not match.21 Jun 2026 - Tip
wp core verify-checksumswp core verify-checksums tells you if someone touched your WordPress filesCompares your WordPress core files with the official list and reports anything changed or unexpected.13 Jun 2026 - Tip
wp cache typewp cache flush empties the wordpress object cache, wp cache type names itShows which object cache backend is active and clears it when stale values appear.2 Apr 2026 - Tip
wp eval 'echo get_option( "blogname" ), PHP_EOL;'wp eval runs a line of PHP inside a fully loaded wordpressExecutes a snippet of PHP with WordPress loaded, without writing a plugin or a template.1 Apr 2026 - Tip
wp db size --tables --orderby=size --order=descwp db size --tables shows which tables take the space in a wordpress databaseLists the size of every table in the WordPress database to find what makes it grow.1 Apr 2026 - Tip
wp core check-updatewp core check-update tells you which wordpress version is waitingLists the WordPress core updates that are available, split into major and minor versions.31 Mar 2026 - Tip
wp rewrite flush --hardwp rewrite flush --hard fixes wordpress 404 errors after a permalink changeRebuilds the permalink rules, and the .htaccess file with --hard, to cure 404 errors on posts.26 Mar 2026 - Tip
wp option get siteurlwp option get siteurl and home show the URLs wordpress storesReads the stored site address and home address to find the cause of redirect loops.25 Mar 2026 - Tip
wp user create anna [email protected] --role=editor --porcelainwp user create adds a wordpress account with a role, --porcelain prints the IDAdds a user with a chosen role from the terminal and prints only the new ID.23 Mar 2026 - Tip
wp plugin list --update=available --fields=name,version,update_versionwp plugin list --update=available shows which wordpress plugins have an updateLists only the plugins that have a newer version available, with installed and offered versions.23 Mar 2026
Shell7
- Tip
wp menu create "Main menu"wp menu builds a WordPress navigation menu from the terminalCreates a classic menu, adds links and assigns it to a theme location by script.30 Nov 2026 - Tip
wp export --post_type=page --dir=exportswp export writes a WordPress content export from the terminalCreates the same WXR file as Tools > Export, filtered by post type or date.30 Nov 2026 - Tip
wp cron testwp cron test tells you whether WordPress can start its own cronChecks whether WP-Cron is switched off or cannot call itself over HTTP.30 Nov 2026 - Tip
wp rewrite structure '/%postname%/'wp rewrite structure sets the WordPress permalink format from the terminalChanges the permalink structure, and optionally the category and tag base, in one command.30 Nov 2026 - Tip
@prod:Aliases in wp-cli.yml run wp commands on a remote site over sshGives a remote WordPress site a short name so wp commands run over ssh as wp @prod.28 Nov 2026 - Tip
wp cron event run --due-nowwp cron event run --due-now runs the stuck scheduled tasksRuns every overdue WordPress scheduled task immediately instead of waiting for the next visitor.1 Aug 2026 - Tip
wp cron event listwp cron event list shows when each wordpress scheduled task runs nextShows every scheduled WordPress task with its next run time and repeat interval.31 Mar 2026
Network4
- Tip
wp server --host=127.0.0.1 --port=8080wp server runs a WordPress site on PHP's built-in web serverStarts a quick local web server for a WordPress folder without Apache or nginx.30 Nov 2026 - Tip
wp search-replace 'https://old.example.com' 'https://new.example.com' --export=moved.sqlwp search-replace with export writes the changed WordPress database to a fileMakes a copy of the database with a new domain in it and leaves the live tables alone.30 Nov 2026 - Tip
wp search-replace 'http://old.example' 'https://new.example' --dry-runwp search-replace --dry-run shows what would change before it touches your databaseCounts the replacements WP-CLI would make in your WordPress database without changing anything.19 Nov 2026 - Tip
wp site list --fields=blog_id,url,registered --format=tablewp site list shows every site of a wordpress multisite networkPrints the sites of a multisite network, either as a table or as plain URLs for scripts.31 Mar 2026
Security3
- Tip
wp user application-password create anna backup-script --porcelainwp user application-password create gives a WordPress REST client its own keyCreates a revocable password for one script or app to call the REST API.30 Nov 2026 - Tip
wp config create --dbname=example_wp --dbuser=example --prompt=dbpasswp config create with prompt keeps the WordPress database password out of historyGenerates wp-config.php with fresh salts while the password never appears on the command line.30 Nov 2026 - Tip
wp user reset-password admin --skip-email --show-passwordwp user reset-password --skip-email changes a wordpress password without mailSets a new random password for a user without sending an email and prints it in the terminal.24 Mar 2026
Storage2
- Tip
wp db import backup.sqlwp db import loads a SQL dump into WordPress with the wp-config credentialsRestores a database dump without typing the database user, password or host.30 Nov 2026 - Tip
wp db export - | gzip > backup-$(date +%F).sql.gzwp db export – pipes a WordPress database dump straight into gzipWrites a compressed copy of your WordPress database without leaving an uncompressed dump on disk.6 Jun 2026
Docker1
CSS1
Nothing matches.