All tags
Start here · wordpressBack 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 wordpress
Narrow down
Guides2
- GuideBack up WordPress with WP-CLI before every update, and test that it restores9 steps · 11 min read
- GuideFix your WordPress file permissions without breaking the siteCheck and fix your WordPress file permissions (755 for directories, 644 for files, a tighter wp-config.php) without locking yourself out.6 steps · 5 min read
Web90
- 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
ls -ld wp-content wp-content/plugins index.phpFS_METHOD in wp-config stops the surprise FTP prompt on updatesWrites plugin updates directly to disk when ownership allows it.1 Dec 2026 - Tip
define( 'WP_TEMP_DIR', '/var/www/example.com/tmp' );WP_TEMP_DIR in wp-config fixes uploads that fail on a temp folderPoints WordPress at a writable folder for its temporary files.1 Dec 2026 - Tip
define( 'CONCATENATE_SCRIPTS', false );Set CONCATENATE_SCRIPTS false in wp-config when the admin looks brokenLoads admin scripts one by one so you can find the failing file.1 Dec 2026 - Tip
define( 'CORE_UPGRADE_SKIP_NEW_BUNDLED', true );Stop core updates from adding new default themes with one wp-config lineKeeps newly bundled themes from reappearing after you cleaned them out.1 Dec 2026 - Tip
define( 'ALTERNATE_WP_CRON', true );ALTERNATE_WP_CRON in wp-config helps when loopback requests failRuns scheduled posts on hosts where WordPress cannot call itself.1 Dec 2026 - Tip
define( 'MEDIA_TRASH', true );MEDIA_TRASH gives the WordPress media library a trash binMakes deleted media go to the trash first instead of disappearing with its files.30 Nov 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
define( 'WP_DEVELOPMENT_MODE', 'theme' );WP_DEVELOPMENT_MODE theme stops WordPress caching theme.json while you workTells WordPress you are developing a theme so theme.json edits show up immediately.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
define( 'RECOVERY_MODE_EMAIL', '[email protected]' );RECOVERY_MODE_EMAIL sends WordPress crash mails to the person who fixes themSends the recovery mode link to a developer address instead of the site admin email.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
define( 'UPLOADS', 'media' );The UPLOADS constant moves the WordPress media folder out of wp-contentPuts new uploads in a folder of your choice, relative to the WordPress root.30 Nov 2026 - Tip
wp option get uploads_use_yearmonth_foldersThe WordPress setting for month and year upload folders only affects new filesExplains the Settings > Media checkbox that sorts uploads into dated folders.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
define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true );WP_DISABLE_FATAL_ERROR_HANDLER shows WordPress fatal errors raw while you developSwitches off the friendly critical error page so you see the actual PHP error.30 Nov 2026 - Tip
define( 'IMAGE_EDIT_OVERWRITE', true );IMAGE_EDIT_OVERWRITE stops WordPress from piling up edited image copiesKeeps one set of edited image files instead of a new set every time you crop.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
define( 'WP_ALLOW_REPAIR', true );WP_ALLOW_REPAIR switches on WordPress's built-in database repair pageTurns on the WordPress database repair page at wp-admin/maint/repair.php, which needs no login.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
define( 'SCRIPT_DEBUG', true );SCRIPT_DEBUG makes WordPress load the unminified scripts and stylesMakes WordPress load readable, unminified core scripts and styles so browser errors are traceable.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
define( 'WP_HTTP_BLOCK_EXTERNAL', true );WP_HTTP_BLOCK_EXTERNAL stops WordPress from calling out to the internetBlocks outgoing HTTP requests from WordPress except to hosts you put on an allowlist.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
define( 'AUTOSAVE_INTERVAL', 180 ); // SecondsAUTOSAVE_INTERVAL in wp-config.php changes how often WordPress autosavesSets the number of seconds between editor autosaves in WordPress.26 Nov 2026 - Tip
define( 'EMPTY_TRASH_DAYS', 60 ); // 60 daysEMPTY_TRASH_DAYS decides how long WordPress keeps your trashSets after how many days WordPress permanently deletes trashed posts, pages and comments.26 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 language core install nl_NLwp language core installs and updates WordPress translationsLists, installs and updates the core language packs of a WordPress site from the command line.25 Nov 2026 - Tip
wp post list --post_status=draftwp post list --post_status=draft shows your unpublished postsLists draft posts from the command line with the fields and output format you choose.25 Nov 2026 - Tip
wp shellwp shell opens an interactive PHP prompt inside your WordPress siteStarts an interactive PHP console with WordPress loaded, to try functions and inspect data.25 Nov 2026 - Tip
wp db checkwp db check tests every WordPress table for corruptionRuns a table check on the whole WordPress database using the credentials from wp-config.php.24 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
define( 'WP_AUTO_UPDATE_CORE', 'minor' );WP_AUTO_UPDATE_CORE decides which WordPress updates install themselvesChooses whether WordPress installs only minor releases, all releases or no core updates by itself.15 Sep 2026 - Tip
define( 'WP_ENVIRONMENT_TYPE', 'staging' );Set WP_ENVIRONMENT_TYPE so plugins know a site is stagingMarks a WordPress site as local, staging or production so plugins and code can behave differently.9 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
define( 'WP_POST_REVISIONS', 5 );Cap post revisions with WP_POST_REVISIONSLimits how many old versions WordPress keeps of each post so the database stops growing.23 Jul 2026 - Tip
define( 'DISALLOW_FILE_MODS', true );DISALLOW_FILE_MODS locks plugin and theme changes, not just the editorStops anyone from installing or updating plugins and themes in the admin, so a stolen login can do less.15 Jul 2026 - Tip
define( 'WP_DEBUG', true );Log WordPress errors to a file and keep them off the screenWrites WordPress errors to a log file while hiding them from visitors on the page.6 Jul 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
define( 'WP_DEBUG', true );WP_DEBUG_LOG accepts a file path so wordpress can log outside wp-contentWrites the WordPress debug log to a chosen path, which can be outside the public web folder.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
define( 'SAVEQUERIES', true );SAVEQUERIES records every wordpress database query with its time and callerStores each database query with its runtime and calling function for finding slow queries.26 Mar 2026 - Tip
define( 'WP_CACHE', true );WP_CACHE true makes wordpress load wp-content/advanced-cache.php earlyEnables the advanced-cache drop-in that page caching plugins use to answer requests before WordPress loads.26 Mar 2026 - Tip
define( 'WP_MEMORY_LIMIT', '256M' );WP_MEMORY_LIMIT and WP_MAX_MEMORY_LIMIT raise the wordpress PHP memorySets how much PHP memory WordPress asks for, one value for the front end and one for the admin.25 Mar 2026 - Tip
define( 'DISALLOW_FILE_EDIT', true );define DISALLOW_FILE_EDIT to remove the wordpress theme and plugin code editorsRemoves the code editors from the wordpress admin menu so admins cannot edit PHP in the browser.25 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
Network10
- 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
define( 'FORCE_SSL_ADMIN', true );FORCE_SSL_ADMIN keeps WordPress logins on HTTPS, mind the proxyForces the login page and admin onto HTTPS and explains the redirect loop behind a proxy.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
define( 'WP_HOME', 'https://example.com' );WP_HOME and WP_SITEURL in wp-config override the URLs stored in the databaseForces the WordPress site address from wp-config.php without changing what the database stores.28 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 search-replace 'http://old.example' 'https://www.example.nl' --dry-runwp search-replace --dry-run shows what a WordPress domain change would touch9 Nov 2026 - Tip
curl "https://example.com/wp-json/wp/v2/posts?_fields=id,title,link"Add _fields to a WordPress REST API request to get a smaller answerMakes the WordPress REST API return only the fields you list, so responses are smaller and faster.1 Sep 2026 - Tip
wp plugin list --status=active --url=https://shop.example.comThe --url flag points wp-cli at one wordpress site of a multisite networkSelects which site of a multisite network a WP-CLI command should run on.31 Mar 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 - Tip
curl -s https://example.com/wp-json/ | jq '.namespaces'curl the wp-json root and jq namespaces to see which wordpress REST routes existFetches the REST API index and lists the route namespaces, including those added by plugins.29 Mar 2026
Shell9
- 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 schedule listwp cron schedule list shows the intervals WordPress cron knows aboutLists the available WordPress cron schedules, such as hourly and daily, with their intervals in seconds.25 Nov 2026 - Tip
define( 'DISABLE_WP_CRON', true );Switch off WP-Cron and let a real cron job do the workTurns off WordPress's visitor-triggered scheduler so a real server cron job runs the scheduled tasks instead.14 Aug 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
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.