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
3
votes
2answers
3k views

WP-CLI Bulk delete posts from specific category

I would like to know how to bulk delete posts from a specific category using the WP-CLI, any tip?
2
votes
3answers
2k 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 ...
-1
votes
0answers
18 views

Refreshing permalinks via Settings or via WP CLI - difference + what happens really?

When I run wp rewrite flush on my server (after deploy where .htaccess is copied over) my translated category pages throw 404. When visiting Settings -> Permalinks everything is fine again. I'm ...
5
votes
2answers
399 views

How to reset passwords for all users on a network using wp cli

I have a WP Network (sub directory), Sometime specially in case of security emergencies, it is generally preferred to change passwords for all users. I am looking for a way to reset passwords by ...
0
votes
0answers
21 views

wp-cli setting home and siteurl to site.tldtld (double TLD)

I'm installing Wordpress with wp-cli. The installation works without failure but it's setting siteurl and home to http://cbdhut.homehome. The command I'm running to install are: cd ${webroot} ./wp....
1
vote
0answers
37 views

WP CLI: there has been critical error

I am using Wordpress 5.3 minimal installation and currently have not installed any other plugins. I have installed WP CLI and below is the output of wp-info: OS: Linux 5.0.0-1025-gcp #26~18.04.1-...
0
votes
0answers
9 views

wp cli import media adding 10 files for each media files on disk. is it a bug?

I copied some files to my server; Then I ran: wp media import *.jpg Then in wordpress > media-library, there are 10 different sizes for each file, EACH size has its own entry in the media library. ...
10
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 its faults, having a command line interface like drush to the Drupal framework is a godsend. Is there an equivalent for using WordPress to ...
2
votes
1answer
52 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 ...
0
votes
1answer
28 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 ...
2
votes
1answer
25 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 ...
1
vote
0answers
39 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 ...
3
votes
1answer
54 views

How can I run a WP-CLI command as authenticated user?

I've written a command for wp-cli called wp nurse. It is styled after the wp doctor command, except is meant to run the WordPress Site Health checks. Using the in-browser tool, all 16 tests currently ...
4
votes
1answer
181 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 ...
1
vote
1answer
26 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
63 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
24 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
33 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
33 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) ...
11
votes
2answers
814 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
510 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
54 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 ...
7
votes
1answer
4k 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
34 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
57 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 ...
4
votes
1answer
73 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?
12
votes
7answers
7k 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 ...
18
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
15 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
12 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 ...
1
vote
3answers
1k 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
24 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
49 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
81 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! ...
5
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
35 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
68 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
28 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
30 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
30 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
25 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
398 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
27 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
102 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
15 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
71 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
55 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
42 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
611 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 2 3 4 5 6