Stack Exchange Network

Stack Exchange network consists of 175 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.

3
votes
1answer
407 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
788 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
1answer
459 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
3answers
1k 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
1k 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
1k 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
202 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
59 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
367 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
1answer
428 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
52 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
2answers
188 views

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

I want to make a user-create snippet, but it must not includes plain password. $ wp user create username username@example.com --role=administrator --user_pass=password So can I create (or update) ...
1
vote
1answer
97 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
1answer
882 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
113 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
129 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
167 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
3k 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
4k 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
4answers
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
131 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
934 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 ...
3
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
851 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 ...
0
votes
2answers
497 views

MySQL 5.6 Causes Errors with WP CLI

I'm running WP CLI and MAMP on my MacBook for a local development environment. My version of WP CLI is current (0.24.1). I've just upgraded MAMP to it's latest version (4.0.4), which also upgrades to ...
0
votes
1answer
563 views

Wp-CLI not working with WordPress installed with composer

I've installed a version of Wordpress using composer, and modified the default folders for the content (/wp-content) and the core (/wp). My wp-config.php gets its DB_NAME, DB_USERNAME, DB_PASSWORD ...
1
vote
1answer
476 views

How to clear Transients on all sites in Multi Sites environment

I know we have the following command available in WP-CLI to remove transients # Delete all transients $ wp transient delete-all However, my question is does it remove transients on all sites over ...
1
vote
1answer
493 views

How to use command lines an activate theme in wp - cli also setup Vagrant/Sage Theme?

I'm still a beginner using Command lines and Sage Wordpress Starter Theme Write steps on what I did to setup everything on my iMac . If you need how wp-cli works and Sage Wordpress Starter works ...
0
votes
1answer
197 views

Removing all post tags except a given list

Got a request from a client to remove all post tags except the ones in a file they provided me. Been trying to figure out how to do it with wp term, but don't see a way to work from a file.. My best ...
4
votes
0answers
1k views

WP-CLI throwing PHP Fatal error: Call to undefined function apply_filters() [closed]

I have a migration script I'm using to copy my production environment to a dev server. Essentially it copies the files, exports/imports the MySQL database (using the wp db export and wp db import ...
2
votes
1answer
570 views

WP-CLI sudden empty response

I set up WP-CLI on a new server this past Monday, which worked as expected and scripts I've made worked following with no issue. Yesterday, running the same script gave errors: PHP Warning: ...
0
votes
2answers
466 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 ...
0
votes
4answers
413 views

What's the proper way to setup WP-CLI on Ubuntu so that I don't have to use the flag --allow-root?

I have an Ubuntu server, typical LAMP stack with default www-data as the user / group under which Apache serves files. When updating with WP-CLI I always have to type --allow-root flag. How do I ...
1
vote
1answer
229 views

WP-CLI can not find Url

When try use this command: php wp-cli.phar core install --url="http://example.com" the command fails. WordPress was installed, but WP CLI complains about an invalid siteurl and home because I have ...
3
votes
0answers
238 views

WP-CLI methods for get_current_blog_id, get_blog_details or $wpdb->prefix

I'm looking for some extra information about an mu site (--url) when attempting to export from a remote server to my local testing environment. One requirement for migration is the existing blog_id ...
3
votes
1answer
293 views

Generate WP-CLI @alias for each site on multisite

I have a few multisites, each with several sites, that I want to auto-generate @aliases for. Is there way to sync those sites as aliases in my site list? I'd like to be able to target a single site ...
11
votes
1answer
1k views

Fastest way (least amount of steps) to locally import a remote database using WP-CLI

I'd like to automate the task of importing a remote database using the WP-CLI. The current process is to ssh to the server, and run an export to file using WP-CLI, copy the file to a local directory ...
-1
votes
3answers
1k views

MAMP PRO WP-CLI Error: Error establishing a database connection

I followed the install instructions at wp-cli.org and am unable to connect to database. I am using a newly installed (this morning) version of MAMP PRO. which php /usr/bin/php echo $WP_CLI_PHP /...
0
votes
1answer
543 views

undefined function apache_request_headers()

I'm trying to run the following command locally: /usr/local/bin/wp plugin deactivate "EG Fulltext Search" --allow-root And I get the error undefined function apache_request_headers() Here is the wp ...
1
vote
1answer
133 views

Import Media To CPT with CLI & Filter Custom Taxonomy

I have a lot of Custom Posts that I need to set featured images for, based on a custom taxonomy. I am trying to see if there is a way to do this via wp-cli, I see an example offered there which would ...
3
votes
2answers
329 views

Unable to write test cases for a WordPress plugin using PHPUnit and WP-CLI

WordPress setup: Installed WordPress using VVV. PHPUnit setup: I have setup the testing suite as mentioned in Pippin's blog. And accessing PHPUnit after logging into the box machine by using vagrant ...
0
votes
1answer
401 views

WP-CLI unable to recongnise PHP server / environment variables on Ubuntu

WP-CLI is doing fine on my Ubuntu server until I am using any server variable in the wp-config.php file. As soon as I using this: define('WPMU_PLUGIN_URL', 'https://'. $_SERVER['HTTP_HOST'] .'/...
0
votes
1answer
49 views

Generate Sub-Comments with WP-CLI [closed]

Using wp-cli, it is possible to generate random comments for posts. Is it also possible to generate sub-comments? If so; how?
0
votes
2answers
516 views

What user should I use for wp-cli on Ubuntu VPS [closed]

I have set-up my first VPS (Ubuntu). Apache 2 and php were pre-installed, I was able to install wp-cli, but it is kinda useless for me know. I am getting user permissions error. For example when I run ...
2
votes
2answers
758 views

Install and load additional plugins when running unit tests

I want to write unit tests for a plugin. I have used WP-CLI to scaffold the test WordPress instance and can successfully run tests. The plugin I'm writing unit tests for is a site specific plugin ...
0
votes
2answers
254 views

Running custom defined WP-CLI commands without Wordpress installation present

I have registered custom commands that scaffording some files. These commands don't rely on any wordpress funcionality, basically outputs some files with content (what commands do is irrelevant in ...
20
votes
2answers
3k views

Detect if WP is running under WP-CLI

I use the wonderful WP-CLI tool. Due to dependence on Apache environment variables for a specific use case, I need to enable a bit of code to run only when running under WP-CLI. How can I detect if WP ...
3
votes
1answer
437 views

Listing posts with wp-cli

I use wp-cli to export some posts from my WordPress database. I'm trying to understand the differences in behavior that are exposed in the example below: $ wp post list --path=/var/www/home-web --...
2
votes
3answers
1k views

Importing featured image to posts, duplicates the image

I'm using wp cli to import the same featured image for around 2,000 posts. I did a couple tests to see if the image would be duplicated or if WordPress would notice that the image already exists in ...