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.

learn more… | top users | synonyms

3
votes
2answers
39 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
0answers
16 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
29 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
45 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 ...
1
vote
2answers
35 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
31 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 ...
6
votes
2answers
376 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 ...
2
votes
1answer
38 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 --...
1
vote
2answers
40 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 ...
0
votes
1answer
38 views

wp-cli only displays PHP version for all input options

I see the same output regardless which input parameters I pass to wp-cli. [tosh@server94]$ wp-cli.phar --info X-Powered-By: PHP/5.4.36 Content-type: text/html [tosh@server94]$ wp-cli.phar help cache ...
0
votes
1answer
19 views

How to fix old embeded iframes with WP-CLI search-replace

I want to change this: <iframe width="850" height="478" src="https://www.youtube.com/embed/4zH9Zca1vRM" frameborder="0" allowfullscreen></iframe> For this: https://www.youtu.be/...
1
vote
0answers
33 views

Wildcard for wp-cli search-replace

I'm trying to perform this search replace: wp search-replace 'http://stage.contraindicaciones.net/app/uploads/2015/{08,09}/' 'http://stage.contraindicaciones.net/app/uploads/2016/03/' But curly ...
0
votes
0answers
24 views

WordPress Unit Testing and theme

I just got into WordPress unit testing for a theme and some plugins for a project I inherited that had no tests. I have been using wp-cli and the WP_UnitTestCase which has been working great. I've ...
3
votes
2answers
98 views

Is it possible just by using wp-cli to migrate one multisite instance to single site?

It took me great time today to convert one site from https://example.com to https://sub.example2.com from WordPress multiste installation to normal WordPress installation (read: singlesite). Since I ...
0
votes
2answers
92 views

How to utilize WP-CLI from inside WordPress, not SSH?

I'm looking for a way to test out some WP-CLI commands but from the Debug Bar Console where I normally test PHP. For cases when I don't want to switch windows to SSH, this might be a way to reuse/...
0
votes
1answer
26 views

ignoring, hidding mu plugins when wp-cli is run

wp-cli & a mu plugin don't get along causing the following error: "Fatal error: Call to a member function getAdminOptions() on null in /wp-content/mu-plugins/mobile-smart-proMU.php" Line of ...
0
votes
0answers
46 views

import image to post content

I can import an image as a post's featured image. wp media import 001.png --post_id=x --featured_image I want to import an image to a post's content. This doesn't work: wp media import 001.png --...
1
vote
2answers
68 views

Can I create multiple pages at once using WP-CLI?

I am new to WP-CLI and having trouble finding examples of what I want to do. I know how to create a single page. wp post create --post_type=page --post_status=publish --post_title='Contact' Is ...
3
votes
1answer
196 views

How to export WP database for import using WP-CLI on Vagrant Box?

Problem Now that I have a new environment with WP-CLI db import / export I need to import a database from a website that never had WP-CLI installed. Question What's the best Non-WP-CLI export ...
1
vote
1answer
37 views

WP-CLI not setting page template with page_template=“template-name.php”

I'm having trouble setting the page template with wp-cli. According to this post, How do I set and list page_template with wpcli, it looks like: wp post create --post_type=page --page_template='...
0
votes
0answers
146 views

WP-CLI mysteriously stopping while downloading the core

I'm jazzed about WP-CLI but for some reason when I run wp core download it says Downloading WordPress 4.4.1 (en_US)... and pauses for 20 seconds or so and then just goes back to the terminal prompt. ...
3
votes
2answers
93 views

Using Travis CI to run unit tests and running phpunit locally [closed]

Is there a difference between Travis CI running my PHPUnit tests and me using the WP-CLI to generate unit test files and running phpunit locally? I'm wondering if the duplicate effort is necessary or ...
1
vote
1answer
87 views

How can I replace all regex matches using the WP_CLI search-replace tool

With WP CLI I can use the search-replace method like this: wp search-replace 'foo' 'bar' However, when I use regex, it only replaces the first occurrence within each DB field: wp search-replace '...
3
votes
2answers
72 views

wp-cli: wp term generate xxxxx - Error: 'xxxxx' is not a registered taxonomy

I'm writing a WP CLI command which creates and updates taxonomies using wp_insert_term. Actions on my custom taxonomies are not accepted since they don't show up as registered. The wp-cli included ...
0
votes
0answers
49 views

WP does not recognize any plugin after defining 'WP_PLUGIN_DIR'

I'm trying to develop a plugin so I want to change the location of these defining the constant 'WP_PLUGIN_DIR' as follows: define('WP_PLUGIN_DIR', '/home/user/Projects/wp/plugins'); Running the ...
4
votes
0answers
48 views

Wp-cli-ssh global installation problem [closed]

Global installation of wp-cli-ssh returns following error: $ composer global require x-team/wp-cli-ssh dev-master Changed current directory to /Users/name/.composer ./composer.json has been updated ...
1
vote
2answers
206 views

wp-cli Enabling Maintainance Mode

During theme or plugin upgrades, maintenance mode is enabled and then disabled once complete. Is it possible to manually enable / disable maintenance mode? Enabling Maintenance mode... Downloading ...
2
votes
1answer
271 views

wp-cli with MAMP shows sh: mysql: command not found

I just installed wp-cli using homebrew and changed the PHP path in .bash_profile to below. export WP_CLI_PHP=/Applications/MAMP/bin/php/php5.6.10/bin/php export PATH=$PATH:/Applications/MAMP/Library/...
2
votes
1answer
113 views

wp-cli: run post generate and post meta add together

I would like to generate a number of posts and attach the same featured image to all posts. wp post generate --count=20 wp post meta add <id> _thumbnail_id 215 But how can I run this two ...
0
votes
1answer
64 views

Correct file permissions for in-browser updates using WP-CLI

I installed WP using WP-CLI (i.e. on the command line on the remote server). I'd like to give another person the ability to change the theme, plugins, etc. using the standard WP admin browser ...
1
vote
0answers
84 views

WP-CLI :: Cannot installing plugin as www-data

Just started using WP-CLI and instead of running with --allow-root, decided to run as www-data user. Things are good so far but cannot install any plugin that way at all: root@wp-ks320:/var/www/ks320#...
5
votes
0answers
61 views

WP-CLI not recognizing commercial plugin updates

I'm running into an issue I haven't encountered before where WP-CLI is not recognizing plugin updates for commercial plugins. The plugin updates appear in my WordPress dashboard, but running ../wp-...
2
votes
1answer
222 views

DataBase connection problem with PHPUnit and WordPress

I'm trying to run PHPUnit to unittest a WordPress plugin, but the error below keeps showing up. Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /private/tmp/wordpress/wp-...
1
vote
0answers
108 views

Update BackupBuddy with WP-CLI

I've written a script that basically loops through all of the WP sites on our server and updates everything: core, plugins, themes. It does, however run into one issue: It will not update BackupBuddy....
0
votes
2answers
94 views

WordPress API - count posts

Is there a way to count the number of posts / pages via the WordPress API? I'm wanting to insert a post then check, using the API, that the count has gone up by 1. I've looked at http://codex....
0
votes
2answers
93 views

WP CLI theme install. Install a private repo?

I have a bash script that installs and activates a theme like this: wp theme install https://bitbucket.org/organization/theme/get/master.zip --activate The problem is that it only works with public ...
0
votes
1answer
92 views

Using wp-cli can I not query pages by their title?

All of these do the same thing: wp post list --post_type=page wp post list --post_type=page --post_title=dfdsfds wp post list --post_type=page --title=sdfdsf How can I query the post by the title? ...
1
vote
1answer
356 views

wp-cli installation

i installed 0h-my-zsh; then wp-cli, change .zshrc file and wrote : # FIX PHP MAMP for WP-CLI export PATH=/Applications/MAMP/bin/php/php5.6.2/bin:$PATH export PATH=$PATH:/Applications/MAMP/Library/bin/...
4
votes
2answers
466 views

how to update serialized options programatically?

I want to automate updating plugin options. There are some things that I repeat a lot. With wp-cli I know I can update simple options like this: php wp-cli.phar option update blog_public 1 However,...
0
votes
0answers
90 views

WP-CLI without phar

I've been trying to get WP-CLI working on a server compiled with --disable-phar (probably for security reasons). Is there any way I can override this and get WP-CLI working anyway? These are the ...
1
vote
0answers
39 views

How can I add an RSS widget using WP-CLI?

I can add an rss widget with this command: wp widget add rss my-sidebar --title=News --items=5 But when I add a URL parameter, like this: wp widget add rss my-sidebar --title=News --items=5 --...
0
votes
1answer
50 views

How to move back a command in WP-CLI from wp shell?

Absolute beginner here... I'm familiarizing myself with WP-CLI, and I typed "wp shell" taking me to wp> (input box) How do I escape wp shell and go back to ["username" /home/public] (input box)? I'm ...
3
votes
2answers
264 views

How to change user_login with wp-cli?

How to change the username with wp-cli? This does not work: wp user update old_login --user-login=new_login
1
vote
1answer
515 views

How to change user password with wp-cli?

wp-cli is great. But it's not clear how I can quickly change a user password with it. How to change a user's password programatically can probably help to figure this out. Although wp user ...
2
votes
2answers
712 views

How to use wp-cli.yml file?

I am trying to set up a wp-cli.yml file but everytime I run the command, the file is ignored. Where should the file be located? And how should I call the command to use it? I tried having a file in ...
1
vote
1answer
162 views

How do I set and list page_template with wpcli?

I have a page that has a new template, and I want to set that new template with wp-cli. When I wp post get <id> I get an output like the following: +-----------------------+--------------------...
1
vote
1answer
41 views

Wrong output order when mixing WP_CLI::API and php-cli-tools

Fixed by WordPress update - cause unknown. I have a couple of plugins that use various custom WP-CLI commands I've written. I've copied then from one WordPress project – where it's working correctly ...
0
votes
1answer
168 views

PHP Parse error on WP-CLI, not on web server

I have a network of over a hundred sites and I try to use wp-cli to make bulk changes to many of these. Particularly to their wp_x_options table via wp --url=site.url option update However, wp ...
1
vote
1answer
534 views

How can I bulk delete media and attachments using WP-CLI?

I'm trying to mass delete 4000 images in a wordpress website. WP itself sets the max to 999, which would work fine and take a few minutes to delete them via the backend. However, I get REQUEST URI TOO ...
1
vote
1answer
183 views

Local Wordpress installs don't verfiy against wp-cli checksum check and how to fix that issue.

i've installed wp-cli today, while testing i ran into one surprising issue. on `wp core verify-checksums' the following errors showed up: Warning: File doesn't verify against checksum: wp-includes/...