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

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.

0
votes
1answer
419 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
398 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
440 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
185 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
492 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
416 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
286 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
129 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
205 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
245 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 ...
10
votes
1answer
894 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
849 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
390 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
112 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 ...
4
votes
2answers
296 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
334 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
47 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
379 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
626 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
222 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 ...
16
votes
2answers
2k 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
368 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
2answers
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 ...
0
votes
1answer
127 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
99 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
237 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 ...
3
votes
3answers
868 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 ...
1
vote
2answers
609 views

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
131 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 ...
1
vote
3answers
2k 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
1k views

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
270 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='...
-1
votes
1answer
157 views

WP-CLI mysteriously stopping while downloading the core [closed]

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
400 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
677 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
222 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 ...
4
votes
0answers
65 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 ...
0
votes
2answers
350 views

How to update WP-CLI on Windows via Composer?

I installed wp-cli back in April on my Windows box using composer. I believe with the following command: composer create-project wp-cli/wp-cli --no-dev as outlined in the alternate install methods on ...
5
votes
2answers
2k 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 ...
3
votes
1answer
1k 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
481 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
476 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 ...
5
votes
1answer
348 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#...
6
votes
1answer
427 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
877 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
244 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
532 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....
1
vote
2answers
560 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
889 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? ...