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

How can I list only sites that use a particular theme or plugin?

I need to search through dozens of WordPress multisite (network enabled) installs for sites that use a particular plugin. How can I list only sites that use a particular theme or plugin, preferably ...
user avatar
  • 41
0 votes
1 answer
267 views

WP-CLI plugin install causes PHP fatal error - Using $this when not in object context

When running sudo wp install plugin pluginname --allowroot It causes an error: PHP Fatal error: Uncaught Error: Using $this when not in object context in /var/www/html/wp-content/plugins/pluginname/...
user avatar
0 votes
1 answer
18 views

Give WP-Cli User Home Directory Privileges

I am on an Ubuntu 18.04 local dev environment, running a WP Multisite 5.5.3 Three Part Question: 1.) What (who) is the WP-Cli user? And, 2.) How do I give that user permission to "my_user's&...
user avatar
  • 143
1 vote
0 answers
360 views

Only the WP CLI command, wp --info, runs under my cPanel account

Please review the following commands I have issued remotely to the Bash Shell on my dedicated cPanel/WHM server: [root@host ~]# wp cli update Success: WP-CLI is at the latest version. Then I ...
user avatar
  • 11
0 votes
1 answer
229 views

WP-CLI Error Requesting CURL Extension

Instantly fell in love with WP-Cli... life at real speed, ditch the GUI.. :-) Each time that I run a command, it executes successfully, however I get the following error message and warning: <br/&...
user avatar
  • 143
3 votes
1 answer
262 views

How can I use WP-CLI commands without --allow-root

I wanted to use WP-CLI commands in my putty WordPress 5.5.1 & Ubuntu 20.04 Droplet but “When I use Wp commands without –allow-root then It shows an error that you are accessing as the root user,” ...
user avatar
  • 41
0 votes
1 answer
41 views

Circumvent WP CLI Command

I am writing a maintenance mode plugin for my multisite setup. At its core its a very simple script that returns a maintenance mode page when a option is set. Now, I want to add cli commands to enable ...
user avatar
0 votes
0 answers
156 views

How to add an array to a command "wp config set"?

you need to add a constant when building a docker file wp-config.php define( 'AS3CF_SETTINGS', serialize( array( 'provider' => 'aws', 'access-key-id' => '*****', 'secret-access-key' => '****',...
user avatar
  • 1
1 vote
1 answer
90 views

Skip WooCommerce 4.5.x onboarding with WP-CLI [closed]

I have a bash (.sh) script that I use to install WordPress and install/activate various plugins through WP-CLI commands. Now I want to extend that by installing/activating WooCommerce and setting ...
user avatar
0 votes
1 answer
70 views

How best to keep my localhost on Http while my Remote production is on Https

I am using a plugin **Really Simple SSL** that configured to use SSL. And I use WP Migrate Pro to move my DB from local to remote. But I usually run into the problem of pulling the DB from productions ...
user avatar
  • 131
0 votes
1 answer
434 views

How do I trigger WP CLI DB export using a PHP function?

I want to use WP-CLI to export a database - using wp db export - to create backups. I also need to use cron to control the backup schedule. WP-CLI is installed on my managed host, and I can use it via ...
user avatar
0 votes
1 answer
3k views

Migrating Multisite with WP-Cli and/or Search-Replace-DB

I have a Wordpress 5.5 / PHP7.3 MultiSite production site installation that I am trying to migrate to my local LAMP dev environment so that I can edit. The Problem: is that when I run Search-Replace-...
user avatar
  • 143
6 votes
2 answers
852 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/...
user avatar
  • 307
0 votes
1 answer
39 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?
user avatar
1 vote
0 answers
437 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 ...
user avatar
0 votes
0 answers
140 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 ...
user avatar
  • 129
2 votes
0 answers
109 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' =...
user avatar
  • 121
1 vote
1 answer
488 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 ...
user avatar
0 votes
1 answer
2k 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 ...
user avatar
1 vote
0 answers
77 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): ...
user avatar
  • 396
0 votes
0 answers
2k 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: ...
user avatar
1 vote
2 answers
449 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. ...
user avatar
0 votes
1 answer
184 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 ...
user avatar
0 votes
0 answers
500 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....
user avatar
0 votes
2 answers
1k 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.
user avatar
0 votes
0 answers
45 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....
user avatar
2 votes
0 answers
325 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-...
user avatar
1 vote
1 answer
269 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 ...
user avatar
  • 133
4 votes
1 answer
850 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 ...
user avatar
2 votes
1 answer
40 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 ...
user avatar
  • 133
1 vote
1 answer
111 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 ...
user avatar
5 votes
1 answer
738 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 ...
user avatar
3 votes
1 answer
2k 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) ...
user avatar
  • 289
1 vote
0 answers
569 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 ...
user avatar
4 votes
1 answer
402 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?
user avatar
  • 291
0 votes
1 answer
75 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 ...
user avatar
1 vote
0 answers
36 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 ...
user avatar
  • 11
0 votes
0 answers
138 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 ...
user avatar
0 votes
1 answer
480 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 ...
user avatar
4 votes
1 answer
896 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 ...
user avatar
3 votes
1 answer
914 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! ...
user avatar
2 votes
1 answer
211 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 ...
user avatar
1 vote
0 answers
145 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 ...
user avatar
  • 13
0 votes
1 answer
237 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 ...
user avatar
0 votes
1 answer
33 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 ...
user avatar
  • 127
1 vote
1 answer
353 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: ...
user avatar
  • 127
1 vote
1 answer
88 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: ...
user avatar
  • 127
1 vote
1 answer
54 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 ...
user avatar
  • 153
3 votes
1 answer
575 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?
user avatar
  • 153
0 votes
1 answer
371 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['...
user avatar
  • 195

1
2
3 4 5
8