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
4
votes
1answer
101 views

WP CLI info showing correct PHP binary but wrong version of PHP

When a run a command such as wp plugin update I get the message: "Your server is running PHP version 5.4.13 but WordPress 5.2.2 requires at least 5.6.20" I don't even have PHP 5.4 installed in my ...
2
votes
1answer
14 views

Ask wp-cli latest core wordpress version released

I'm trying to make a script (bash) that examines all wordpress installations on my server and returns a set of information. I would need to know the latest known version of wordpress (official ...
0
votes
1answer
20 views

Where do the files of a custom WP CLI Command reside?

I want to create a custom WP CLI command and I have read the documentation but I just don't understand for the life of me how this works. Do I need to declare it before in my config file where they ...
3
votes
1answer
38 views

Does wp post delete also delete metadata associated with posts?

say this: wp post delete --force $(wp post list --post_type=product --format=ids) I found out that it's far more fast and performant than deleting posts from admin. But I was wandering: any ...
0
votes
0answers
15 views

WP-CLI works for all installations but one

I have the latest wp-cli installed on Windows 10 Pro. Running WP locally on laragon. For all installs, I've got it to work nicely, but at one of them, any wp-cli command except wp --info doesn't do ...
0
votes
0answers
16 views

WP-CLI regex - search-replace match specific tags and any characters in between

I am using WP-CLI regex to replace specific tags and the content within the tags. Note that the content between the tags is dynamic so can change. I want to replace everything between [vc_row ...
1
vote
1answer
16 views

Remove all users from site except one using WP CLI

I would like to remove all users from WordPress site using WP CLI except one (me, as administrator). This command remove every user: wp user delete $(wp user list --field=ID --number=10) ...
10
votes
2answers
763 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-...
0
votes
1answer
1k 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 ...
0
votes
2answers
506 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 ...
1
vote
0answers
39 views

How to delete 1000s of duplicated images in Wordpress?

We kinda have a wired problem that took me weeks of searching and testing, the problem is that while working on one of my client's Wordpress website I noticed that there are around 75k images in ...
5
votes
1answer
3k views

How can I bulk delete media and attachments using WP-CLI?

I'm trying to mass delete 4000 images in a wordpress website. WP itself sets the max to 999, which would work fine and take a few minutes to delete them via the backend. However, I get REQUEST URI TOO ...
0
votes
0answers
23 views

wp-cli wp media regenerate --only missing deletes unused sizes?

I just ran wp media regenerate throught 200k images... thing is I have 400k, and the range command is not working (200000 400000 | xargs ***) If I use wp media regenerate --only missing will it ...
0
votes
1answer
23 views

wp-cli core install unknown: fatal: file /etc/postfix/main.cf: parameter mail_owner: user postfix has same user ID as _postfix

I'm trying to setup two wordpress virtual hosts on my macbook using a shell script composer and wp-cli. The first virtual host has been working perfectly. When I run the script for the 2nd virtual ...
3
votes
1answer
64 views

Difference between deactivating, uninstalling, and deleting plugins

I understand the difference between deactivation and uninstallation. But the CLI also has a delete option. How does it differ? To be safe, should I deactivate, then uninstall, then delete?
10
votes
7answers
6k 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 ...
17
votes
5answers
6k 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
0answers
14 views

WP-CLI command to rename menu?

Do you know a wp-cli way to rename menus? I don't see any reference to that in the documentation. Tried wp menu: usage: wp menu create <menu-name> [--porcelain] or: wp menu delete <menu&...
0
votes
0answers
10 views

Synchronize multisite: diff of activated plugins and settings

I have a multisite setup with an increasing number of languages and it’s a bit of a plugin mess. Consequently I’m about to start building something around wp-cli that can help me with this by first of ...
0
votes
1answer
16 views

wp-cli plugin activate - 'activate' is not a registered subcommand of 'plugin'

I just downloaded the latest version of wp-cli bundle to my Mac and now this wp-cli plugin activate XXXXX doesn't work it gives me the message wp plugin activate XXXXXXX 'activate' is not a ...
1
vote
3answers
953 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 ...
1
vote
0answers
23 views

Update a post based on results from GET request to another server

I need to use GET requests to retrieve the current status of a device and then update the body of a specific Wordpress post with the text data sent by the external device (for reference, it will use ...
0
votes
0answers
39 views

wp-cli core install --skip-email and --skip-config flags not working on MAMP unknown parameter

This command wp core multisite-install --url="dev3.XXXXXXX.wp" --title="XXXX" --admin_user="XXXXXadmin" --admin_password="XXXXX123" --admin_email="XXXX@XXXX.com" --skip-email --skip-config Creates ...
2
votes
1answer
45 views

Is there a way to pre-cache plugins with wp-cli for faster installation?

So I can cache a wordpress installation with: wp core download --version=4.5 --path=/tmp/wp45 Subsequent requests of version 4.5 will be pulled from wp-cli local cache. I think that: wp plugin ...
2
votes
1answer
40 views

WP-CLI update date and time format

I'm new to WP-CLI. After a lot of Googling and searching in this forum, I haven't found out which is the command to update both date and time formats. wp option update...... Thanks for any help! ...
3
votes
3answers
4k views

WP-CLI - Selecting PHP version

On a development server I have a co-install of PHP 5.6 & 7; nginx is configured with PHP 5.6. When I type "wp" it returns several errors and at the end of the error is a message containing the ...
1
vote
0answers
26 views

WP-CLI search-replace posts content for certain URLs

Using WP-CLI I am wanting to search and replace posts content but only for certain URLs. This is what I have so far: $ wp search-replace 'Contact us today' 'Contact us today by filling in the form ...
0
votes
1answer
51 views

Create Wordpress Multisite Instance Programmatically

Our CI process sets up everything from scratch, including WordPress, and our WordPress is a multisite instance. Adding a site after the Multisite functionality has been setup is easy to do ...
0
votes
1answer
27 views

How do I deactivate widgets by name?

I cna get list of widgets with wp widget list sidebar-1 | search | search-2 | 1 | {"title":""} | recent-posts | recent-posts-2 | 2 | {"title":"","number":5} | recent-comments ...
1
vote
1answer
24 views

How do I update a nested option?

I use this command to get values of ez-toc-settings->auto_insert_post_types wp eval "print_r(get_option('ez-toc-settings')['auto_insert_post_types']);" and this prints out the correct values: ...
0
votes
2answers
29 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 ...
1
vote
1answer
20 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: ...
0
votes
2answers
392 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
1answer
18 views

How to retrieve text only from a post using WP CLI?

I have the post ids and urls. I need to extract the post content make some modifications and update again. I have more than 2,000 posts hence I would like to do it using WP CLI and not manually. Can I ...
1
vote
1answer
67 views

How to change a post attribute to homepage using WP CLI?

I want to convert a page to homepage. To add widget to homepage I need to do that. How will I be able to do that using WP CLI?
0
votes
0answers
13 views

“New_Version” in Plugin Update is blank

When updating WP-MAILTO-LINKS, the new version is always blank. So, in my environment the update is done every night, because WP-CLI thinks, that my installaed verison is old... :(
0
votes
1answer
47 views

wp-cli PHP Notice after moving server behind load balancer

After setting up an Amazon Elastic Load Balancer, where SSL terminates, I was getting Mixed Content errors on the site, until I added the following line to wp-config.php. if (strpos($_SERVER['...
2
votes
1answer
44 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
1answer
32 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
396 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
272 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-...
1
vote
1answer
390 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
47 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
443 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
22 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
25 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
6k 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
43 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, ...