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.

2
votes
1answer
124 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
161 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
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
122 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
800 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
766 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
475 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
524 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
455 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
482 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
192 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
547 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
451 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
377 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
186 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
224 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
277 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
990 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
486 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
123 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
314 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
376 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
471 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
706 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
242 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 ...
19
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
411 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
142 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
107 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
255 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
970 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
692 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
143 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
2k 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
305 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
419 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
772 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
229 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
67 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
372 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 ...