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

0
votes
2answers
26 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 ...
4
votes
2answers
354 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
31 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
28 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
34 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
18 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: ...
1
vote
0answers
25 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
21 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
76 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
80 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 ...
0
votes
1answer
23 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
41 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
53 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
160 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
30 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 ...
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
80 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
75 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
65 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
48 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
47 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
169 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
222 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 ...
2
votes
1answer
97 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
56 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
73 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: ...
4
votes
0answers
53 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 ...
2
votes
1answer
201 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 ...
1
vote
0answers
102 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 ...
0
votes
1answer
69 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 ...
0
votes
2answers
87 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
76 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
348 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 ...
4
votes
2answers
401 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 ...
0
votes
0answers
89 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
32 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
49 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
242 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
444 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 ...
0
votes
0answers
26 views

After “wp export” from WP-CLI, Wordpress users cannot log in to the wp-admin

I was trying to export a xml file to test some things in a new production server. Here's my steps and the error that occurred: From the command line, in the root of the application: sudo wp ...
0
votes
0answers
146 views

Help With MultiSite SEO Problems

I really could use some help with setting up our MultiSite Network for SEO optimal results. Setup is like this: MultiSite installation setup as sub domains Hosted on a Pagely VPS with a dedicated IP ...
1
vote
1answer
603 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
139 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
158 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
484 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
172 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: ...
2
votes
2answers
2k views

How Can I setup WP CLI on Windows development machine running AMPPS?

I want to setup WP CLI. On the home page it says that it needs a UNIX like operating system. I am running windows 7 for development but I could probably setup a virtual Ubuntu box or something. Would ...
1
vote
2answers
120 views

What's a better workflow for database migration?

When asked to work on an existing WordPress Site, I generally take a copy of the whole site and work on it locally. For quite a few years I have used a script such as the following after importing the ...
1
vote
1answer
37 views

Is resetting post data necessary with custom WP_CLI commands?

Is it strictly necessary to call wp_reset_postdata(); in a WP CLI command? I am doing it out of habit but just wondered if the $post object needed to be reset.