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
0 answers
5 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 ...
0 votes
0 answers
14 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 ...
0 votes
1 answer
945 views

Logs for WP CLI

I am running a WP CLI script to regenerate images, seq 192000 194000 | xargs wp media regenerate —only-missing and i got errors, example: Warning: Can’t find “margot-fox-pope-francis-post” (ID 204823)....
0 votes
1 answer
801 views

Creating a subcommand for custom wp-cli command

I'm toying around with writing custom wp-cli commands. I have successfully created a simple command, wp-cli theme save which runs a script to backup the site's theme files: <?php class ...
1 vote
1 answer
2k views

WP CLI not finding plugin commands

On a Ubuntu 20.04 Linode I have a Wordpress installation. I deploy the website using https://github.com/Mixd/wp-deploy, a Capistrano deployment tool. When the website is deployed the folder structure ...
0 votes
2 answers
633 views

WP-CLI wp theme install url PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature

I tried use wp-cli theme install with option url from my dropbox link. But unfortunately, I got this problem: PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature This ...
0 votes
0 answers
75 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::$...
0 votes
1 answer
627 views

WP-CLI: detect altered core files and restore them automatically

I know that there is a command to verify the integrity of the core files: $ wp core verify-checksums In case a file is corrupted or altered, is there any WP-CLI command to automatically restore all ...
2 votes
1 answer
23 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 ...
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 ...
1 vote
1 answer
44 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", "...
0 votes
1 answer
92 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 ...
0 votes
1 answer
128 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-...
0 votes
1 answer
83 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.
1 vote
2 answers
680 views

Error establishing a database connection when running phpunit

I'm following https://make.wordpress.org/cli/handbook/plugin-unit-tests/ to run unit tests for plugins. I create a new plugin. $ wp scaffold plugin hello-plugin-1 Success: Created plugin files. ...
-1 votes
1 answer
46 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 ...
1 vote
2 answers
1k views

Bulk remove custom post type and its attachments with wp-cli?

I have a custom post type called "meetings" and I will like to bulk remove all the posts and all of its attachment images... Can this be done with the wp-cli? thank you!
0 votes
0 answers
20 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" ...
3 votes
1 answer
3k views

Remove all users from site except one using WP CLI

I want to remove all users from the WordPress site using WP CLI except one (me, as administrator). This command will remove all users: wp user delete $(wp user list --field=ID --number=10) ...
0 votes
1 answer
140 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 ...
4 votes
4 answers
5k views

wp-cli is not working properly. No response from commands

I am trying to make a copy of a live site on a test server. I installed wp-cli and wp-cli sometimes works and sometimes doesn't. When it doesn't work, it just returns nothing. Not one character of ...
0 votes
1 answer
100 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 ...
1 vote
1 answer
96 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 ...
0 votes
0 answers
43 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 ...
0 votes
1 answer
28 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 "...
1 vote
1 answer
150 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" ...
3 votes
3 answers
6k views

Change old URLs after the domain change

I have setup wordpress on my server, and after some time I've changed the domain name of the installation. However, all of the old urls within the site point to the old domain. How can I change old ...
0 votes
2 answers
47 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'...
0 votes
0 answers
146 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 ...
1 vote
2 answers
465 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,...
3 votes
4 answers
1k views

Set Site Icon programmatically (eg. using `wp cli`)

Wordpress has a "Site Icon" feature that serves correctly-sized favicons and so on to browsers. Is there a way to drive this feature programmatically, eg. by uploading media and setting an option with ...
0 votes
1 answer
68 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 ...
1 vote
2 answers
104 views

wpcli: Error on post_content or post_title if accents

When I try to create a new post with accents width wp-cli (in windows 10 command, I got latest wp-cli) wp post create --post_title="Héllo" --post_type=page --post_content="Héllo world" I got error: ...
2 votes
2 answers
920 views

Save (same) permalink from wp-cli

I moved many WordPress sites to a new server and all permalinks need to be "refreshed". I need to save again (without any changes) settings->permalinks to resolve pages/posts 404 error. I ask if it ...
1 vote
0 answers
30 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....
2 votes
0 answers
191 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 ...
7 votes
3 answers
9k views

How to use wp-cli.yml file?

I am trying to set up a wp-cli.yml file but every time I run the command, the file is ignored. Where should the file be located? And how should I call the command to use it? I tried having a file in ...
-1 votes
1 answer
197 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 ...
5 votes
1 answer
628 views

WP-CLI methods for get_current_blog_id, get_blog_details or $wpdb->prefix

I'm looking for some extra information about an mu site (--url) when attempting to export from a remote server to my local testing environment. One requirement for migration is the existing blog_id ...
1 vote
1 answer
104 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 ...
2 votes
1 answer
76 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-...
1 vote
0 answers
70 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 ...
0 votes
0 answers
57 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 ...
28 votes
6 answers
13k views

Running WP Cron on multisite the right way

I have WordPress Multisite with several sites. I set up DISABLE_WP_CRON to true in my wp-config.php. If we set up cron task with wget or curl we have 30 sec rule to execute PHP script. It's so small ...
0 votes
1 answer
67 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 ...
0 votes
0 answers
51 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 ...
1 vote
1 answer
114 views

How to change user admin_color with WP CLI?

I like to know how I can change a users admin color theme with WP CLI.
1 vote
0 answers
63 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" ...
0 votes
1 answer
214 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 ...
0 votes
1 answer
32 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 ...

1
2 3 4 5
8