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

WPCLI search and replace variants for all tables

What is the difference between: wp search-replace 'http://' 'https://' --allow-root to: wp search-replace 'http://' 'https://' --all-tables-with-prefix --allow-root AFAIU, the first search and ...
user avatar
1 vote
1 answer
379 views

How to rename default category name and slug using WP CLI?

Using WP CLI how can I rename default category (Uncategorized) to Blog when starting a new project? Following documentation this should be correct? wp term update category 1 --name="Blog" But I get ...
user avatar
0 votes
1 answer
90 views

One-click WP site generation wih wp-cli on Windows

If I run these commands sequentially in windows CMD, I get a site up and running quite quickly. wp core download wp core config --dbname=my_wp_database --dbuser=root --dbpass=my-db-password wp core ...
user avatar
2 votes
1 answer
502 views

Configuring WP-CLI on Windows 10

I've installed php5-cli using bash, but Wordpress is using XAMPP's PHP 7 install. I've added /mnt/c/xampp/php to the PATH, and I've explicitly used export WP_CLI_PHP='/mnt/c/xampp/php' in .bashrc. ...
user avatar
0 votes
1 answer
2k views

wp-cli: Error establishing a database connection: undefined constant DB_USER

Bringing this over from the wp-cli github page. I've been searching here, the docs, and the webs for several hours. Currently hosting with Blue Host and they are using version 1.2.0 :( I can't seem to ...
user avatar
5 votes
1 answer
8k views

Run WP-CLI using PHP

I've installed WP-CLI on the Mac and my next step is to execute WP-CLI commands using PHP script. I've tried to implement it the following way but I do not see anything happening. Can someone please ...
user avatar
  • 53
1 vote
0 answers
154 views

Can I check which users ran which updates?

We have a site that was previously updated to 4.8.0. Two of us who normally perform updates did not have the right permissions to run the 4.8.1 update. Using wp-cli wp core update Error: Could not ...
user avatar
  • 53
2 votes
1 answer
2k views

Can wp-cli display all users and their roles across all sites in a multisite instance?

List Multisite Users Using wp-cli(1) If I run wp user list I get a list of the users (2 admins in my case) at the top level of multisite(2). List Multisite Sites' Users I have 25 sites with various ...
user avatar
  • 53
8 votes
1 answer
5k views

How do I run a PHP script from Wordpress environment, like `wp shell`?

wp shell is a very useful tool that lets you run PHP statements and expressions interactively, from within a Wordpress environment. It lets you use all the functions, classes and globals that you can ...
user avatar
  • 595
0 votes
2 answers
591 views

PHPUnit via WP-CLI: Warning: Cannot modify header information ... bootstrap.php:68

I'm trying to setup unit tests for a plugin I am developing. I just followed the steps at... https://make.wordpress.org/cli/handbook/plugin-unit-tests/ However, when I run phpunit I get the ...
user avatar
1 vote
1 answer
2k views

WP-CLI command to update all plugins and core fails when executed from cron

I have the following WP-CLI command to update all plugins and core. It seems to fail when being executed from cron (other cron commands work): 0 0 * * 0 for dir in /var/www/html/*/; do cd "$dir" &...
user avatar
2 votes
1 answer
733 views

How to verify a correct wp-cli installation?

I've installed wp-cli (or so I think) on my VPS, Centos 6.9. when I'm logged in as my user, wp is found; but when I run wp --info from my home directory; I receive: PHP binary: /usr/local/bin/php ...
user avatar
  • 545
0 votes
1 answer
83 views

When installing wordpress through WP CLI mysite.com/admin not working

When I am downdloading wordpress and manually installing it, then mysite.com/admin working which opens the admin panel. But when I am insatlling wordpress using WP CLI /admin not redirecting to admin ...
user avatar
1 vote
0 answers
80 views

cURL to install theme

I can't figure for the head of mine how to write a cURL that would install a theme for me once I got a session. Tried binding these headers, but with no success: _wpnonce _wp_http_refferer _themezip ...
user avatar
  • 11
0 votes
1 answer
165 views

Combine WPCLI commands for plugin installation and activation?

Instead of running the command for plugin installation and then the command for activation: sudo for dir in /var/www/html/*/; do cd "$dir" && wp plugin install elementor anywhere-elementor ...
user avatar
4 votes
1 answer
535 views

wp media regenerate unknown --image_size parameter

It is said in the documentation that we can set the --image_size parameter to regenerate all images for only this size. However, I am getting this for this command: Error: Parameter errors: unknown -...
user avatar
2 votes
1 answer
423 views

Categories not shown in admin after adding woocommerce products via wp wc cli

After the following script is run wp wc product create --name='b' --categories=32 --user=user Output is printed: Success: Created product 1370. But no categories are shown in wp-admin/WooCommerce->...
user avatar
  • 225
7 votes
2 answers
3k views

Changing the WP CLI cache folder

As a highly concerned hosting company owner I am using WP-CLI to update plugins, themes and wp core of my clients. Updating WP-Core find /home/*/public_html -name "wp-admin" -execdir /home/wp core ...
user avatar
  • 213
2 votes
2 answers
664 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 ...
user avatar
6 votes
1 answer
2k views

How to update an 'array' option using wp-cli [duplicate]

I'm trying to write a bash script to automate the syncing of a live site to a dev site. I have the basics figured out, like exporting the production db and importing / updating urls in the dev site, ...
user avatar
0 votes
0 answers
341 views

WP Cli + xargs fails

I'm trying to regenerate thumbnails using seq but I get signal 9 error. here is my command: $ seq 146280 146300 | xargs wp media regenerate --url='http://www.my-site.com' Found 15 images to ...
user avatar
  • 191
1 vote
1 answer
36 views

Resetting internal WordPress state during its cycle

Is there any api or system to reset internal cycle? I need this, cause when I use wp-cli in the shell I need to call for instance get_header more times in one session. The fast is when I call this ...
user avatar
  • 85
0 votes
0 answers
236 views

WP CLI - Pass Query / URL Variable to Cron?

Is there a way to pass URL / Query variables when you run: wp cron event run using WP CLI? I have a specific event and ID I want to pass to it but don't know if it is possible or how to pass GET ($...
user avatar
  • 101
7 votes
3 answers
5k views

How can I batch delete all unattached images with WP-CLI or other automated process?

After using WPML Media, a plugin that creates duplicates of each image for each language, we now have almost 100,000 duplicate images that we're not going to use and need to get rid of. We need to ...
user avatar
3 votes
0 answers
673 views

Setting Up PHPUnit tests for WP development on Windows

I've been following the instructions in this article to try to set up some testing. I got as far as this instruction bash bin/install-wp-tests.sh wordpress_test root 'mypass' localhost latest before ...
user avatar
1 vote
1 answer
729 views

Error updating WP-CLI

Below is the output from my attempt to update wp-cli on Windows 10. Clearly another version is available. Can someone please explain how to make this work? C:\Users\HP>wp cli update Error: You can ...
user avatar
4 votes
2 answers
1k views

WP-CLI - Return posts with matching meta key

I am using the WP-CLI to manage my sites. I can run the following command wp post list --fields=ID,mycustomfield ID | mycustomfield ----------------------- 1 | active 2 | active 3 ...
user avatar
  • 1,067
1 vote
0 answers
83 views

wp-cli fails on installing to subdomain

it's likely I missed something, but I just tried to use wp-cli to install Wordpress on a subdomain. After succesfully downloading, creating wp-config and calling the install procedure with: wp core ...
user avatar
2 votes
0 answers
814 views

ACF image field to WordPress featured image

I am working with a CPT that is using ACF fields to manage content and the hero image. With the new Archive page template, I wish to have featured images alongside the content. Earlier we did not ...
user avatar
2 votes
2 answers
461 views

Unable to install plugins from wp-cli

Hi I am using a Ubuntu system. I am using a shell script to download wordpress from wget, update config and run it from nginx server. Now I want to update this shell script so that when we install a ...
user avatar
  • 151
0 votes
0 answers
50 views

Wp-cli from a plugin?

WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, configure multisite installs and much more, without using a web browser. Please note that WP-CLI is ...
user avatar
  • 4,169
1 vote
1 answer
163 views

Error: reassigning content to a different user is not supported on multisite

Objective:There's a need to remove a user from the multisite. Before doing so, user's content needs to be "transferred to another user" in a subdomain setting/specific site that's not the parent. ...
user avatar
  • 11
0 votes
1 answer
118 views

Is it possible to update a single page using WP-CLI?

I'm currently working on a website which is based on Wordpress. It's not that usual Wordpress blog which is using posts but rather a non-profit association website. Once a week a single page need to ...
user avatar
  • 101
0 votes
1 answer
101 views

Add passwords to config.yml to manage multiple sites

Is there a way to add a password for each site in my config.yml file so that I can manage multiple sites with different usernames and passwords? It looks like I can add the username, but it prompts ...
user avatar
  • 3
3 votes
1 answer
2k views

How can I get the WP-CLI eval-file command to report errors to stderr?

I'm writing a one-off script to update some posts in the database. Whenever there is an error in my script, it fails silently. I've followed the suggestions in this Github issue without success: ...
user avatar
1 vote
2 answers
1k views

Is it possible to use WP-CLI via PHP-framework?

I have Zend framework 2 application (PHP), via which I want to use WP-CLI functionality. near Zend project I have WordPress project, which I want to maintain from Zend via WP-CLI. I see in the docs ...
user avatar
0 votes
1 answer
89 views

Is it possible to use WP CLI to update a theme that is not in the WordPress Repo?

I have been looking everywhere across the Web (including the GIT Repo and Stack Exchange) for an answer to this Question. Is WP CLI's wp theme update command only available for themes that are in the ...
user avatar
0 votes
1 answer
200 views

How do I extract the contents of a CPT's custom field for all posts?

I need to generate a CSV report with information that is stored into a few custom fields of a custom post type. How do I list just the content of these custom fields, for all — or a subset &...
user avatar
5 votes
2 answers
976 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 ...
user avatar
3 votes
4 answers
177 views

How do I setup a WordPress site on a server before the domain is ready?

I've completed my install using wp-cli. Right now the server is only available within my organization's VPN and the domain (say, foo.org) is being used by the existing (non-WordPress) site that will ...
user avatar
3 votes
1 answer
653 views

wp core update not working anymore

I have a strange issue. Trying to update core wp version from 4.7 to 4.7.2 but wp keeps saying I am already up to date. But when I run wp core version Then I see 4.7 and not 4.7.2 Any ideas on how ...
user avatar
  • 133
1 vote
3 answers
3k 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 ...
user avatar
1 vote
1 answer
729 views

Reset generated wp-config.php with wp-cli

I'm trying to dig into wp-cli and I can't find how to reset a config file I've created with the following command line (Note: I'm in the folder where I want the wordress to be installed): $ wp core ...
user avatar
  • 160
5 votes
3 answers
3k 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 ...
user avatar
2 votes
1 answer
4k views

WP-CLI with theme: Uncaught Error: Class 'WP_CLI' not found

Updated:: I am having issues when adding a custom cli command into an existing wordpress theme. When I run wp --info I get the following: PHP binary: /usr/local/Cellar/php70/7.0.13_6/bin/php PHP ...
user avatar
  • 21
1 vote
1 answer
2k 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 ...
user avatar
  • 1,821
0 votes
2 answers
426 views

wp-cli for Creating page-template

I've recently started using wp-cli to work on WordPress and starting to love it. However, I'm curious about creating page templates using wp-cli. I haven't been able to find anything on it, does ...
user avatar
0 votes
2 answers
262 views

WP CLI allowed fields?

Very basic question, but I couldn't find an answer. I am using the WP CLI post get command: https://wp-cli.org/commands/post/get/ One of the option is [--field=], but I can't find in the doc the ...
user avatar
  • 135
4 votes
0 answers
716 views

WP WC CLI - WooCommerce setup store with wp-cli [closed]

WP-CLI provides a few commands to manage coupons, orders and more. Is a command exist to setup a store with wp-cli(The setup screen with store settings and WooCommerce store pages)? Something like: ...
user avatar
  • 715
1 vote
1 answer
2k 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 ...
user avatar

1
4
5
6 7 8