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
0answers
29 views

Enable Auto-updates for all plugins using wp-cli? (since wordpress 5.5)

Since WP 5.5 just released and now you can set plugins to auto-update, can this be done via wp-cli? Looking at the documentation, I don't see a sub-command for it: https://developer.wordpress.org/cli/...
0
votes
1answer
23 views

Remove files unrelated to WordPress from uploads

Is there a wp-cli command or any easy way to remove files that are unrelated to WordPress, but FTPed or synced to the uploads directory accidentally?
1
vote
0answers
16 views

How to use WP-CLI / WC-CLI to bulk import 1000s of products (variable and simple)?

I am a junior developer and I have been asked to work on a wordpress site that has previously been using All Import plugin to upload products. The problem is, this is not functioning properly, and is ...
0
votes
0answers
20 views

wp cli search and replace on --network Error reconnecting to the database

I'm getting a new Vagrant VM WordPress setup. I've downloaded my production db and I normally I go through and use a search and replace to find a production url and change that to a local development ...
2
votes
0answers
31 views

WP WPQuery, not running properly in WP CLI

I'm running a simple query just to find simple WooCommerce products, here is the query which works fine in the header of the site: $args = array( 'post_type' => 'product', 'posts_per_page' =...
0
votes
0answers
18 views

Is it possible to delete a range of posts by ID with WP-CLI?

I am in the process of learning WP-CLI and I typed in the command line mistakenly wp post generate instead of wp post generate --help Now I have generated the default 100 posts, however, this is a ...
0
votes
0answers
13 views

'wp-cli post generate' is creating missed scheduled posts

I am using the wp-cli to generate test posts. I ran the command wp post generate --count=20 --post-status=publish Now all my posts appear to have missed the schedule. When I add --post_date="...
0
votes
0answers
11 views

How to add custom post meta key:value in woocommerce using wp-cli

I am Using WooCommerce cli to create product but having issue to add custom filed (key:value in postmeta table) wp wc product create --name="Test Title" --description="Description goes ...
0
votes
0answers
16 views

cli > why wp core update says it can't connect to db, while wp db can do it?

I've got a strange problem. The site is running properly, both back and frontend. I just want to update it via wp cli. wp core update It keeps saying Error: No such file or directory and that ...
0
votes
0answers
32 views

Can't Connect to MySQL Database using WP CLI and MAMP on a macOS Catalina, using Oh My Zsh

I'm running macOS Catalina and am trying to use WP CLI with MAMP, with iTerm2 and Oh My Zsh as my command line. However in my localhost directory when I enter wp in the command line, and then press q ...
0
votes
0answers
21 views

Rebuild thumbnails via WP Cli - how?

I can use wp media regenerate to regenerate thumbnails. But I need to rebuild first, before I can regenerate. In the GUI of WordPress I have two buttons (if I have AJAX Regenerate Thumbnails plugin): ...
0
votes
0answers
219 views

WP CLI in WP 5.3 with PHP 7.4

Working with the WP REST API WP-CLI in WP 5.4, by selecting PHP 7.3 the call to wp post works as usually: wp post list But changing to PHP 7.4 (current) throws me the following errors: Deprecated: ...
0
votes
1answer
44 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. ...
0
votes
0answers
16 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 ...
0
votes
0answers
18 views

wp-cli import throws ERROR 1045 (28000) password error after changing DB password; wordpress and mysql work with new password

I'm Running Wordpress on a Bitnami VM. I updated the database user's password for my wordpress site. Everything except wp-cli works fine with that new password. Relevant part of wp-config.php looks ...
0
votes
0answers
25 views

WP CLI: critical error on your website

I want to use the cli to update my wordpress instance. Unfortunately, I alwas get the "critical error on your website" message. I've already checked the error.log of my webserver and also the debug....
0
votes
2answers
99 views

How to run wp cli from a wp hook?

How can I run a wp cli command when a wordpress hook is called on my website. On user registration hook, I would like to run a wp cli command to activate a license.
0
votes
0answers
33 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....
2
votes
0answers
107 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
12 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. ...
1
vote
0answers
66 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
137 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 ...
2
votes
1answer
29 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
1answer
37 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 ...
0
votes
0answers
44 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 ...
4
votes
1answer
165 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
78 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 ...
2
votes
1answer
146 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) ...
1
vote
0answers
141 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 ...
0
votes
0answers
81 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 ...
4
votes
1answer
122 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?
0
votes
0answers
17 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
13 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
42 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
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
66 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 ...
0
votes
1answer
193 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
348 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
201 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! ...
2
votes
1answer
75 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 ...
1
vote
0answers
54 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
115 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
29 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
63 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: ...
1
vote
1answer
40 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: ...
1
vote
1answer
31 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 ...
2
votes
1answer
190 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
1answer
133 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
147 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
98 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 ...

1
2 3 4 5 6