Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
1answer
205 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->...
5
votes
2answers
621 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 ...
2
votes
1answer
300 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 ...
2
votes
1answer
690 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, ...
0
votes
0answers
106 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 ...
1
vote
1answer
32 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 ...
0
votes
0answers
69 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 ($...
4
votes
1answer
1k 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 ...
3
votes
0answers
247 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 ...
1
vote
1answer
226 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 ...
2
votes
1answer
341 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 ...
1
vote
0answers
39 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 ...
2
votes
0answers
442 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 ...
1
vote
1answer
119 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 ...
0
votes
0answers
39 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 ...
1
vote
0answers
32 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. ...
0
votes
1answer
39 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 ...
0
votes
1answer
57 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 ...
2
votes
1answer
441 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: ...
1
vote
2answers
84 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 ...
0
votes
1answer
47 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 ...
0
votes
1answer
78 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 &...
2
votes
0answers
243 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 ...
4
votes
4answers
107 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 ...
3
votes
1answer
328 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 ...
0
votes
2answers
606 views

Installing Wordpress via WP-CLI: not working with a 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
1answer
384 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 ...
1
vote
2answers
941 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 ...
0
votes
1answer
981 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 ...
1
vote
1answer
860 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 ...
0
votes
2answers
173 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 ...
0
votes
1answer
58 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 ...
2
votes
0answers
321 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: ...
1
vote
0answers
303 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 ...
0
votes
0answers
32 views

WP CLI update in main and subfolders

I have many sites install in sub folder, the structure look like below: /public_html/ /public_html/site1-directory /public_html/site2-directory How I can run single cli to update core for /...
0
votes
0answers
51 views

Can I use WP-CLI from a remote computer?

Does WP-CLI need to be used and installed on my server which has WordPress installed, and as such, I would need to ssh into that server in order to use it?
2
votes
1answer
136 views

Can I create (or update) user password with WP-CLI by hash?

I want to make a user-create snippet, but it must no includes plain password. $ wp user create username username@example.com --role=administrator --user_pass=password So can I create (or update) ...
0
votes
0answers
69 views

How to prevent WP-CLI shell from exiting when an exception occurs?

I am using WP-CLI shell to quickly debug some code, but every time I run into a fatal exception (e.g. undefined constants/functions) the shell exits and I lose my shell session. Is there a way to ...
0
votes
0answers
536 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 ...
1
vote
0answers
100 views

How do I add HTML code to a widget with wp-cli?

I want to add a YouTube video to a widget via wp-cli. The YouTube video is basically an iframe. When I execute the following command: wp-cli widget update text-1 --text='<iframe src="http://...
2
votes
1answer
113 views

Why would WP-CLI and WP Admin show different list of plugins with updates?

I'm running a local dev instance of WP on my MacBookPro (WP 4.6.1 and WP-CLI 0.24.1). Can anyone explain why I might see a list of 5 or 6 plugins that have available updates when I go to Admin's ...
2
votes
1answer
157 views

Execute wp-cli command on all sites on server

Im pretty sure someone knows the answer, i'm trying to find a way to execute wp cli commands to all sites on my server. So my directory structure is /srv/users/serververpilot/apps/*/public The ...
1
vote
0answers
28 views

For a specific theme, how do I build a list of all the possible theme modification names?

I'd like to use WP-CLI to modify a theme with wp theme mod. But, I do not know what all mods and their associated keys I can set with these commands. I've found that if I change a specific theme ...
3
votes
3answers
2k 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 ...
4
votes
1answer
3k views

WP cli --path does not seem to work

WP-cli does not seem to work when adding a --path param me@host:~$ wp plugin status --path=`/home/me/domains/example.com/public_html` -bash: /home/me/domains/example.com/public_html: is a directory ...
1
vote
2answers
1k views

WP CLI Shell not working on Windows

I recently installed WP-CLI on windows with the instructions below. However when I type wp shell I get en error: The system cannot find the path specified. One solution on github says: Psysh is not ...
0
votes
1answer
105 views

WP CLI Core install - blank database

A very strange thing has started happenning with my local WP installs... I am using latest version of MAMP Pro, and running: wp core install --url="http://example.local" --title="example" --...
0
votes
4answers
669 views

Get media url (featured image) with wp-cli

I am attaching an image to a post with the media import command. I know I can get the image id using the --porcelain option, but how can I get the image url from this id? Or is there a way to ...
2
votes
1answer
2k 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
1answer
692 views

wp-cli regenerate media is not working for custom sizes

I'm using wp media regenerate to generate thumbnails. While this works for the built-in Wordpress image sizes (even when the width and height are customized in functions.php), it does not work at all ...