Questions tagged [wp-cli]

WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser.

Filter by
Sorted by
Tagged with
0 votes
1 answer
8 views

Which WP-CLI commands can be safely run with --allow-root flag?

Over the past several years, WP-CLI has become pretty popular, but there's still a lot of warnings about the --allow-root flag for security reasons, and instead developers are urged to use non-root ...
Jesse Nickles's user avatar
0 votes
0 answers
10 views

Is there a technical difference between invoking `wp-cron.php` and using `wp cron event run`?

For years I've been running cron by setting DISABLE_WP_CRON to true in wp-config.php and then setting up a cron on my server that runs like this: * * * * * cd /path/to/site/public_html && /usr/...
shaune's user avatar
  • 101
0 votes
0 answers
22 views

Is there a WP CLI hook for handling ctrl+c

I know there are hooks for writing custom commands as found here: https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-add-hook/ In my case, I want to handle cleaning up on exit (...
James John's user avatar
1 vote
0 answers
17 views

How to revert the media structure from /uploads/year/month to the /uploads directory in wordpress?

I tried to use wp-cli using regex like this: wp search-replace 'uploads/[0-9]+/[0-9]+/' 'uploads/' --all-tables --regex but in this case there is a problem with possibly repeated file names and ...
Macsurf's user avatar
  • 11
0 votes
1 answer
35 views

Changing boolean value with "wp option patch"

I am trying to change a boolean value (in a serialized object) via wp option patch. But it doesn't work. If I use true (without quotes), it changes to string, if I use 1, it changes to int. Is there a ...
Alleinunterhalter's user avatar
2 votes
2 answers
275 views

What are the proper permissions for production use of wp cli

I am running several instances of WP on GCP VMs and a test VM setup with Ubuntu 22.04 / PHP8.1 and followed the instructions at https://make.wordpress.org/cli/handbook/ to install wp cli. The wp info ...
Richard's user avatar
  • 121
0 votes
1 answer
56 views

Cannot Flush Permalinks with WP-CLI

I am using wp-cli to create a WordPress website. I am running LAMP server. I am able to change the permalinks from ugly to pretty with the following commands: wp rewrite structure '/%postname%' wp ...
Badan's user avatar
  • 225
0 votes
1 answer
10 views

wpcli search-replace fails; reports that mysqli needs to be installed

I'm trying to run 'wp --search-replace' within a vhost webroot on an apache host. The operation returns: Please check that the `mysqli` PHP extension is installed and enabled. If you are unsure what ...
bob's user avatar
  • 249
0 votes
0 answers
46 views

Skip un-set meta fields ("Invalid field: fieldname") when using `wp post list` and displaying custom fields

We have custom fields called country and coordinator. This works: $ wp post list \ --post__in=81153 \ --post_type=boardmember \ --fields=ID,post_title,post_name,post_date,post_status,country,...
3wordchant's user avatar
0 votes
0 answers
134 views

Trying to run only certain action-scheduler tasks from WP-CLI

I'm writing a plugin that performs several actions, one of which is a complex routine that parses and imports a large Excel spreadsheet (don't ask). I want this routine to run as a background task, ...
brettkelly's user avatar
0 votes
0 answers
44 views

Uncaught Error: Class ‘WP_Upgrader_Skin’ not found

WP-CLI 2.9.0 run with –debug …. Debug (bootstrap): argv: /bin/wp core check-update –debug –path=/home/web/public_html (0.752s) Debug (bootstrap): ABSPATH defined: /home/web/public_html/ (0.752s) Debug ...
Jimmy's user avatar
  • 1
2 votes
0 answers
34 views

@wordpress/env cli doesn't seem to properly update permalink structure until visiting the WP Admin Permalink settings page

I'm using https://www.npmjs.com/package/@wordpress/env to set up a local docker-based WordPress development environment, which has been working great so far. I'm trying to build a script using ...
jv-dev's user avatar
  • 121
0 votes
0 answers
194 views

Unknown phantom user "wordpress" created with admin privileges

We've been seeing a user created out of nowhere named "wordpress" every so often, with most of our wordpress sites on a couple Ubuntu 20 servers. I run a quick audit across our server using ...
blueionRich's user avatar
0 votes
0 answers
100 views

Could not reset Wordpress user password using WP CLI

I have a wordpress site (6.2.2). I forget my admin password. The site is not setup with SMTP yet, so the forget password link won't work. I tried several ways, but none of them works. 1. WP CLI - No ...
LHA's user avatar
  • 101
0 votes
0 answers
132 views

WP-CLI delete customers in bulk

I have a staging site and need to give an access to developers. So, I have to delete all customers just in case. I have below command. But I feel there should be better command. Can you advise? wp ...
Burak's user avatar
  • 1
0 votes
0 answers
57 views

Does wp i18n CLI has a prototype of "update-json" file?

I correctly internationalized a javascript file from wp theme folder. Now I would like to know if Wordpress team plans to propose a CLI to update json without losing existing translation. It seems ...
imagIne's user avatar
  • 53
0 votes
0 answers
269 views

WP-CLI PHP Deprecated Warning

Under WordPress 6.3, PHP 8.2, MySQL 8.0.34, WP-CLI 2.8.1, for wp command like this: wp post list --post__in=mypostid I have this warning: Deprecated: Creation of dynamic property Post_Command::$...
Brethlosze's user avatar
2 votes
1 answer
65 views

WP CLI switching post status from publish to future not working?

I want to use wp cli to change post status from published to future, however it appears that once a post is published, it can no longer be switched to future. When I try to do this the post remains ...
user2491463's user avatar
1 vote
1 answer
198 views

How can I use xdebug with wp-cli

I'd like to use xdebug and vscode to debug a script I'm running via wp eval-file. My launch.json is pretty basic. { "name": "Listen for Xdebug", "...
JJS's user avatar
  • 123
0 votes
1 answer
575 views

Warning: Constant WP_DEBUG already defined

PHP 8.1.17 WP-CLI 2.7.1 WP set up as multisite network Adding the following line to wp-config.php (line 107)… define('WP_DEBUG', true); …causes wp-cli to report the following… $ wp plugin list ...
aslamK's user avatar
  • 11
0 votes
1 answer
261 views

Run a WP-CLI command from within PHP without using shell_exec()

Is there another way for me to run a WP-CLI command from within a PHP script other than using the shell_exec() function.
TKEz's user avatar
  • 111
-1 votes
1 answer
218 views

Should I run wp cron event run via crontab or as a daemon?

In my server I've run: sudo -u www-data wp cron event run --path=/var/www/blog.example.com --all But I do not know should I run wordpress cron using crontab or make it into a service using systemd ...
Dimitrios Desyllas's user avatar
0 votes
0 answers
53 views

Trying to remove all references from old domain in wordpress site after migration to new domain

I have moved a website from old domain to new domain and have used the following WP CLI command $ wp search-replace --skip-columns=guid "olddomainname.com" "newdomainname.com" ...
Kiwiheretic's user avatar
0 votes
1 answer
667 views

'wp' is not recognized as an internal or external command, operable program or batch file

I can't get WP-CLI to run on Windows. Downloaded https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar to c:\wp-cli\wp-cli.phar, Added c:\wp-cli\ to the System & User Path ...
Steve's user avatar
  • 1,707
0 votes
1 answer
299 views

What is the correct way to implement wp-cron server-side in Kubernetes?

I'm not sure if this is the correct place to ask the question, but since this is specific to deploying WordPress, I thought I'd ask here first. What is the correct way to implement wp-cron server-side ...
JakGuru's user avatar
0 votes
0 answers
60 views

Transitioning a big blog to WEBP images

I have a Wordpress site with a LOT of posts that still get significant amount of traffic (10,000's of posts). The site is image heavy and uses <img> tags for inline Jpegs as featured and inline ...
gravy's user avatar
  • 157
1 vote
1 answer
435 views

Batch Replace URLs in Wordpress Database

I will be using this command with WP-CLI to batch change about 1,000 URLs. while IFS=, read orig new; do wp --dry-run --skip-themes --skip-plugins search-replace "$orig" "$new" ...
JoaMika's user avatar
  • 668
1 vote
1 answer
164 views

wp media regenerate says "no regeneration needed" whe that's no the case

I'm trying to generate thumbnails for a PDF attachment. Right now in the uploads/ folder there is only the PDF file, no image thumbnails related to it. But when I run the regeneration with : wp media ...
mike23's user avatar
  • 5,981
0 votes
1 answer
36 views

Disappearing plugins

I've had a problem with disappearing plugins lately. Several of my plugins are installed and are working, but you can't see them in the admin plugin interface, only WP-CLI. The plugins are "...
scott8035's user avatar
  • 220
0 votes
2 answers
109 views

Post Count for Multisite?

Is there a way to get post count for all active sites on a multisite, using WP-CLI? Conceptually, I'm looking for a combination of wp post list --format=count and wp site list --format=count but I don'...
whakawaehere's user avatar
0 votes
0 answers
237 views

is it possible to use wp cli to export custom post types

i have been trying to use WP CLI to export custom post type 'product' from custom taxonomy 'product_brand'. however, my command is exporting a random list of products, from other brands. it also is ...
challenge2022's user avatar
0 votes
1 answer
160 views

wp cli media commands not working

I am trying to bulk update media file captions through WP CLI so i can attribute image creators. My command is as follows: wp media list --date="2022-02-24" --format=ids | xargs -n 1 wp ...
challenge2022's user avatar
1 vote
1 answer
29 views

Why doesn't "wp db cli" enable tab completion?

I would like to use tab completion when using the MySQL REPL accessed by running wp db cli. However it doesn't seem to work, even though my ~/.my.cnf file contains this content: [mysql] auto-rehash ...
Flimm's user avatar
  • 684
1 vote
0 answers
43 views

Why not attaching images after impoting using wp cli

I want to move posts from one site to another, because of the big amount of posts I am trying with wp-cli import. The destination site also has huge amounts of posts, now when I am importing XML files....
Mi2's user avatar
  • 11
2 votes
0 answers
297 views

Using wp-cli on remote with quoted commands

I have my wp-cli.yml configured with a working ssh connection. If I wp db query "CHECK TABLE $(wp db tables | paste -s -d, -);" and run locally it works just fine. On the other hand, if I wp ...
Tom Ransom's user avatar
-1 votes
1 answer
310 views

Weird WP -Cli Error Connection Refused

I have a rather of wp-cli problem. I am using wp-cli to import a db from my test server into my staging server and even though the import is successfully and everything seems to be working correctly ...
mjones's user avatar
  • 153
0 votes
1 answer
252 views

Can WP-CLI modify database connection details in existing wp-config file?

I am aware of WP-CLI's many database interaction functions via "wp db" and its functions for generating wp-config files via "wp config" - However I cannot find a way of using WP-...
mayersdesign's user avatar
1 vote
1 answer
218 views

Does DISABLE_WP_CRON prevent plugins from registering new cron tasks?

If I set DISABLE_WP_CRON to true in my wp-config.php file, then will it block plugins from registering new cron events (eg with calls to wp_schedule_event()) define( 'DISABLE_WP_CRON', true ); I've ...
Michael Altfield's user avatar
2 votes
1 answer
185 views

How to install WordPress with Composer?

I want to install WordPress and WP CLI both with Composer. This is how I install Drupal and Drush (Drupal's CLI tool) with Composer: cd WEB_APPLICATION_ROOT composer create-project drupal/recommended-...
yoine's user avatar
  • 21
1 vote
0 answers
95 views

wp-cli output 'column display format' / wrapping

First of, I'm not sure what the correct technical name is for this. The problem is the display width for the first column (or maybe total table width) on commands like wp plugin list and it outputs ...
piet's user avatar
  • 111
0 votes
0 answers
72 views

WP-CLi Uable to Install / Update Plugins

From the command WP-Cli is unable to install or update plugins, throwing the following error: The package could not be installed. "PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir ...
mjones's user avatar
  • 153
0 votes
1 answer
107 views

wp-cli incorrectly believes a plugin is currently installed

I ran wp plugin deactivate woocommerce --uninstall and it did so successfully. I verified with #ls wp-content/plugins the woocommerce folder no longer exists. Problem: when I run wp plugin install ...
mjones's user avatar
  • 153
0 votes
0 answers
60 views

WordPress CLI isn't working while use WordPress development repository

I cloned the repo from https://github.com/WordPress/wordpress-develop.git After that followed the README file from the downloaded code and installed node dependencies and execute the below commands in ...
Ashok Dhaduk's user avatar
1 vote
0 answers
99 views

Remote Export DB w. WP-cli.phar Over SSH

I am trying to export a remote wp db using the following: source_gzip_db=git-dumps/export.sql.gz source_path_to_wordpress=/home/username/public_html source_ssh_host="123.456.789.12" ...
mjones's user avatar
  • 153
0 votes
1 answer
444 views

When might you need to specify the "url" argument/option in WP-CLI?

I have read several blog posts and discussions about the url option in WP-CLI and have seen many different opinions and interpretations, so I assume I'm not alone with this question... The official ...
Jesse Nickles's user avatar
0 votes
1 answer
42 views

What is the purpose of the "user" global parameter in wp-cli.yml config?

According to WP-CLI documentation, you can specify "user" using inline arguments, or in the global configuration. I understand there might be a task you want to run against a specific ...
Jesse Nickles's user avatar
0 votes
0 answers
118 views

WP-CLI Add category as menu item main-menu

I've found this documentation about adding terms using WP CLI: https://developer.wordpress.org/cli/commands/menu/item/add-term/ and tried to find out how I can add an existing category to the main-...
stefantriep's user avatar
0 votes
1 answer
155 views

wp_clear_object_cache() is deprecated. What should I use instead?

Today I noticed that \WP_CLI\Utils\wp_clear_object_cache() has been marked as deprecated in WP-CLI 1.5.0. The release notes don't mention anything about it. What should be used, instead? Do I still ...
rassoh's user avatar
  • 586
2 votes
1 answer
195 views

Setting boolean and array values using wp theme mod set

I need to set a couple of Theme Mods to boolean and array values using WP CLI but can't find any way to do achieve it. I have already tried the following for booleans, but they appear to be treated as ...
Dash Desai's user avatar
1 vote
2 answers
774 views

How to find what pages/posts contain a particular reusable block?

How can I find out what pages and post on a site contain a particular reusable block? Typically, to find content on a site, I issue wp db search *itemlookingfor* (like the post ID, part of a file name,...
Will's user avatar
  • 759

1
2 3 4 5
8