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
1answer
980 views

PHP warning are displaying when using WP CLI

I'm running WP CLI 0.25.0 on Debian, PHP 7.0. I keep getting the PHP warnings displayed. In php.ini used for cli I have set error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING ...
7
votes
5answers
4k views

WP CLI “Error establishing a database connection” in localhost (MAMP)

I get this error when I try to create something with WP CLI: Error establishing a database connection. This either means that the username and password information in your `wp-config.php` file is ...
8
votes
2answers
660 views

WP-CLI not recognizing commercial plugin updates

I'm running into an issue I haven't encountered before where WP-CLI is not recognizing plugin updates for commercial plugins. The plugin updates appear in my WordPress dashboard, but running ../wp-...
2
votes
1answer
29 views

How to run nested xargs commands?

I am trying to loop through all sites on a multisite network, and for each site, delete all subscriber users. I have tried this WP-CLI command: wp site list --field=url | xargs -n 1 -I ^ wp user ...
0
votes
2answers
473 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
1answer
24 views

How to delete a single post using wp cli in command line?

I want delete a single post using wp cli in the command line. There was some issue on one article, where my hosting disabled networking & now want me to remove the article using the console. I ...
2
votes
2answers
63 views

“Could not open input file” error even when WP-CLI is in the path

I'm developing Wordpress locally with XAMPP, and currently trying to install the WP-CLI tools as described here using Cygwin. I renamed wp-cli.phar to wp, made it executable and moved it to the ...
1
vote
1answer
53 views

“Class 'Phar' not found” error setting up WP-CLI with Cygwin

I'm trying to install the WP-CLI tools as described here using Cygwin, which the guide claims is supported. When doing: cd /XAMPP/htdocs curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-...
0
votes
1answer
51 views

WP-CLI over SSH - wp command not found

I'm stuck trying to do the remote SSH with WP-CLI. I have installed WP-CLI on my Webfaction server and tested it's working # This is in server $ wp --info OS: Linux web561.webfaction.com 3.10....
0
votes
1answer
32 views

How to specify which editor is used when editing posts with WP-CLI?

On macOS, when I do wp @alias post edit 1 I get nano. The same happens when I do EDITOR=emacs wp @alias post edit 1. I want emacs, My EDITOR is set to emacs. How do I get emacs? Note that env|grep ...
2
votes
2answers
404 views

How to create post in WP network using WP-CLI

How create post using WP-CLI at time of network site create. I am creating network sites using WP-CLI. I have tried: wp post create --post_type=page --post_title='ABC' --post_status=publish --network ...
0
votes
0answers
14 views

Write WP-CLI core check command to file with table structure

If I run the following in console: wp plugin list --update=available I get: +--------+--------+-----------+---------+ | name | status | update | version | +--------+--------+-----------+-------...
2
votes
3answers
1k views

Importing featured image to posts, duplicates the image

I'm using wp cli to import the same featured image for around 2,000 posts. I did a couple tests to see if the image would be duplicated or if WordPress would notice that the image already exists in ...
1
vote
1answer
21 views

wp-cli configuration in php?

https://make.wordpress.org/cli/handbook/config/#config-files is pretty good, but I'd like to have some more logic in my configuration. Is there a standard way for this? For drush I have .drush/...
9
votes
4answers
2k views

Is there a drush equivalent for WordPress yet?

I'm working with Drupal on a project right now, and for all it's faults, having a commandline interface like drush to the Drupal framework is a godsend. Is there an equivalent for using Wordpress to ...
4
votes
3answers
5k 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
vote
0answers
41 views

WP-CLI can't list posts

I have a WordPress Multisite (behind a firewall). I use WP-CLI for lots of things. But for some reason wp post list does not work. wp post get works. But wp post list always yields the same output, ...
2
votes
2answers
48 views

wp-cli silently fails with 255 when running wp core install

Working within a Docker container (circleci/php:latest) and I'm struggling with wp-cli a bit. When I attempt to run wp core install I get a silent failure with 255 exit code. I enabled --debug hoping ...
1
vote
1answer
1k views

WP CLI not importing media files

When I tried on localhost, it appears media files are imported. When I tried on real server (AWS LightSail) seems like images are not imported why might it be? I did not ask it to --skip The main ...
0
votes
1answer
23 views

Is it possible to view WP documentation within the WordPress shell?

I'm having trouble navigating the WP documentation so forgive me if this is common knowledge. Is it possible to view the documentation of classes and methods from within the shell? That is, is there ...
0
votes
2answers
825 views

WP-CLI not working from Bash script

I am trying to make installations easier on my Mac using MAMP by using WP-CLI. I made a simple .sh file: wp core download wp core config --dbname=dbname --dbuser=root --dbpass=root wp db create wp ...
0
votes
0answers
40 views

bash script wp-cli search-replace 0 replacements, but command-line 3000+

I'm runnning this command; sudo -u www-data wp search-replace www.siteurl.com www.newsiteurl.com --recurse-objects --skip-columns=guid --skip-tables=wp_users From command line: 3.456 replacements ...
3
votes
1answer
81 views

wp-cli create post and media import

I would like to create a post and insert a url as an image, right now I have this, it works but creates a gallery block, instead I would just like to create a simple image block . What is the correct ...
1
vote
2answers
116 views

wp search-replace (not executing)

I'm running multisite. Looking to replace old URLs with new URLs for pulling a copy of the site form one environment to another environment. Here is my command: wp search-replace --url=domain.com ...
3
votes
2answers
803 views

Using WP CLI to set options in WP Multisite

I have WP-CLI working fine using WP Multisite (or network). I can create blogs, add users, set permissions etc. But am not certain how to enable plugins for individual blogs via WP CLI. For example, ...
2
votes
1answer
541 views

wp-cli commands do nothing, return nothing

I'm using wp-cli 1.5.1. My server is running php7.2. I'm not running suhosin. (Some people seem to think that suhosin may cause the same symptom) When I issue wpcli commands within a non-wordpress ...
0
votes
3answers
63 views

WP changes siteurl, but some URLs then don't work

I have a WP installation that needs moving to a new site URL. I have tried the usual methods listed on this codex. All of them produce the same problem. When I hit a link like this on the site: <...
3
votes
1answer
188 views

wp core install database connection error

I am new to wordpress but not to programming to please bear with me. I am trying to get a new wordpress project up and running locally using the wp-cli. But when I run the following command: wp core ...
1
vote
1answer
43 views

Does WP-CLI support updating multiple options via a single command?

I'm looking for a way to update multiple options via a single update command. The documentation only suggests the following usage: wp option update <key> <new_value> Does WP-CLI accept ...
10
votes
3answers
3k views

wp-cli Enabling Maintainance Mode

During theme or plugin upgrades, maintenance mode is enabled and then disabled once complete. Is it possible to manually enable / disable maintenance mode? Enabling Maintenance mode... Downloading ...
3
votes
1answer
64 views

Need MySQL Query or WP-CLI command to updates old URLs in Shortcodes [closed]

My client's website is moved from http to https, and I have updated most of the URLs using queries in phpMyAdmin, but I have been unable to update shortcode URLs. I have used the following query to ...
2
votes
1answer
137 views

How to activate an mu-plugin with wp-cli

Do I need some extra WP-CLI bundle to activate mu-plugins via command line? I can't find anything about that in the docs. Are mu-plugins treated differently by WP-CLI? I created /wp-content/mu-...
1
vote
1answer
107 views

How to prevent WP-CLI shell from exiting when an exception occurs?

I am using WP-CLI shell to quickly debug some code, but every time I run into a fatal exception (e.g. undefined constants/functions) the shell exits and I lose my shell session. Is there a way to ...
0
votes
2answers
831 views

WordPress API - count posts

Is there a way to count the number of posts / pages via the WordPress API? I'm wanting to insert a post then check, using the API, that the count has gone up by 1. I've looked at http://codex....
1
vote
1answer
450 views

Error when setting up phpunit tests with wp-cli scaffold

I am trying to figure out the setup for unit tests for wordpress plugins. I am using Ubuntu. So far I have: Local WordPress Installation WP-CLI up and running Installed phpunit used wp scaffold ...
1
vote
1answer
232 views

How to use wp db export and import together?

When I use WP-CLI I'm having some issues with the wp db export and wp db import commands. I have a local site on my desktop that I would like to migrate to my laptop so I can work on it. So I go on ...
3
votes
1answer
105 views

WP-CLI Process Killed

I have around 1200 large images which I'd like to regenerate. I'm using the WP-CLI command wp media regenerate. After around 61 images are generated, the terminal shows the message Killed. Why is ...
0
votes
2answers
380 views

How to update WP-CLI on Windows via Composer?

I installed wp-cli back in April on my Windows box using composer. I believe with the following command: composer create-project wp-cli/wp-cli --no-dev as outlined in the alternate install methods on ...
1
vote
2answers
31 views

Removing a wordpress multisite installation and preserving the database before migrate to nginx

I have a WordPress multisite installation, and I need to remove the multisite, and keeps just the site ID 5 (domain.com/br) in the main address (domain.com). So I follow this tutorial to remove ...
1
vote
0answers
25 views

Overwrite media matching post title using WP CLI's media import command

I am trying to overwrite a media post using the WordPress CLI. The wp post create --post_type=attachment command can create an empty media item, but cannot attach an image file through WP-CLI. This ...
0
votes
1answer
63 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 ...
0
votes
1answer
35 views

Adding content from file with wp post create

I thought I had seen something like this documented where you could pipe in content to a wp-cli arg like so: wp post create --post_type=page --post_title="Blah" --post_content= < content.txt I ...
2
votes
1answer
72 views

WP-CLI How to generate a list of posts with corresponding meta values

I created this SQL query to generate a list of posts (which I will use for a CSV Sheet) SELECT p.ID, p.post_content, p.post_title, pm1.meta_value as 'Amazon.com', pm2.meta_value as 'Amazon.co.uk' ...
2
votes
2answers
199 views

Can I create (or update) user password with WP-CLI by hash?

I want to make a user-create snippet, but it must not includes plain password. $ wp user create username username@example.com --role=administrator --user_pass=password So can I create (or update) ...
0
votes
1answer
39 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
0answers
25 views

Sync users from production and development environments using wp cli

I want to sync users registered at production environment to development environment. Using the below command sequence for this: 1) Find max user id at the target dev environment using: wp ...
1
vote
4answers
2k views

WP CLI Shell not working on Windows

I recently installed WP-CLI on windows with the instructions below. However when I type wp shell I get en error: The system cannot find the path specified. One solution on github says: Psysh is not ...
0
votes
1answer
55 views

WP CLI - show users whose ID is larger than given ID

The below code achieves what i need for given ID = 200. wp user list --role='customer' --orderby=ID --order=asc | awk 'FNR == 1 {next} $1>200 {print ;}' How to do it with wp user list and WP ...
1
vote
3answers
1k views

How do I clone or duplicate a post with the WordPress Command Line Interface WP-CLI?

I know that I can clone or duplicate a post with several plugins. The one I use most often is https://wordpress.org/plugins/duplicate-post/. However I am using the WP-CLI more and more lately and I ...
0
votes
1answer
57 views

WP-CLI --meta-input error: Warning: Invalid argument supplied for foreach()

I'm using this code to import posts from a csv file, which works great except for the meta_input (custom fields) while IFS=$'\t', read -r col1 col2 col3 col4 col5 col6; \ do \ wp post create \ --...