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

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.

0
votes
0answers
26 views

Unable to import complete data remote wp-cli wordpress

I wanted to make process of wordpress site migration automate everything works fine but i am unable to import complete site from remote to local.Might be something wrong in code, any help will be ...
1
vote
2answers
174 views

PHPCS: Strings should have translatable content

I am validating plugin to make it compatible with WPCS. a function which contains gettext placeholder returning error when i run phpcs command. Source code and screenshot of error is attached for ...
9
votes
1answer
802 views

Why is it important to deactivate a plugin before deleting it?

I stumbled across this page, where it says that wp plugin delete does this: Deletes plugin files without deactivating or uninstalling. Why is it important to deactivate a plugin before it is deleted? ...
0
votes
0answers
59 views

Warning Message is get displayed after executing wp-cli command using linux crontabs

I wanted to update WordPress core version and all plugins every week, so for this I install WP-CLI on my WordPress installed server. So, for doing this I wrote wp-cli command in Linux shell script as ...
0
votes
1answer
33 views

WP-CLI plugin delete command fails silently

I have just started trying out WP-CLI and did a basic test of installing a plugin. It installed fine, no issue. However, the plugin delete command fails silently, with no error messages and the ...
4
votes
1answer
39 views

What is the difference between the Package Language and the Site Language?

What is the difference between the Package Language and the Site Language? If I run: wp core language list I get: en_AU | English (Australia) | English (Australia) | active | available If I run: ...
0
votes
0answers
35 views

Moving Featured Images

I have been moving around 40k posts from one site to another (different domains), using wp cli, all went well, but it seems the featured image weren't imported. I have now uploaded all media files ...
1
vote
1answer
211 views

Shortest way to install WP-CLI

That's the shortest way I know to install the WordPress shell extension WP-CLI: curl https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar > /usr/local/bin/wp && chmod +...
1
vote
0answers
117 views

wp-cli search is returning 'search' is not a registered subcommand of 'db'

I'm trying to search for a string like this: wp db search some-string and get: Error: 'search' is not a registered subcommand of 'db'. See 'wp help db'. wp help db lists 11 subcommands and search is ...
2
votes
2answers
301 views

How to disable XML-RPC from Linux command-line in a total way?

I read near the end of this guide regarding utilizing SSHguard to protect WordPress from Brute force attacks that after configuring SSHguard the relevant way, one must: disable XML-RPC by blocking ...
0
votes
1answer
58 views

Using wp-cli and delete everypost first image

I was change my website template then i have one problem which before used template was not have thumbnail place for post for this i add all my post first image for this now on new template showing ...
1
vote
1answer
73 views

Automate dir and DB stack creation with WP-CLI

This is how I create a database stack and a directory for WordPress in my Ubuntu environment: cat <<-DBSTACK | mysql -u root -p"${dbrootp}" CREATE USER "${domain}"@"localhost" IDENTIFIED BY ...
2
votes
1answer
125 views

Export list of users with first and lastname in WP-CLI

I want to export a CSV file with a list of my Wordpress site users with WP-CLI. I can do this but I'm getting my users first and lastname together in one column (display name), I would like to get ...
1
vote
0answers
86 views

Shortest script to install a WordPress webapp on Nginx

The following script is the one I use on Ubuntu-Nginx environments, to get a WordPress webapp up and running. I run it with a domain as an argument: bash ~/nwsm.sh example.com My question is what ...
1
vote
1answer
186 views

How to create a network using a command line script?

I would like to run UI automated tests for my WordPress plugin. I am using Docker to run a WP instance and it runs my tests, that is fine. I am using wp-cli to install and config a testing site. I ...
0
votes
0answers
119 views

How to update subsite's siteurl in WordPress Multisite configuration using WP cli

I can easily update the site url of a subsite by navigating to Network Admin->Sites and change in the particular subsite's siteurl. However, i would like to programmatically change the siteurl using ...
5
votes
4answers
1k views

WP CLI “Error establishing a database connection” in localhost (MAMP)

I get this error when I try to create something with WP CLI: Error establishing a database connection. This either means that the username and password information in your `wp-config.php` file is ...
0
votes
2answers
101 views

A shorter way to automatically update WordPress?

This is how I started to update WordPress daily: cat <<-"CRON_DAILY" > /etc/cron.daily/nses_cron_daily for dir in /var/www/html/*/; do cd "$dir" && /usr/local/bin/wp plugin ...
0
votes
0answers
48 views

How to fix “Not enough memory” on Windows 7 and PHP 7.2.0 (cli)

I installed wp-cli tool on windows 7 but when I type wp --help. It noticed error "Out of memory". Pleased help me know WHY and how to fix it?
2
votes
1answer
446 views

WP-CLI get all posts from certain post type and taxonomy term

I am trying to select all the posts from certain post type and term in custom taxonomy, but what ever I try gets me just the list of all the posts in certain post type wp post list --post_type=custom-...
1
vote
0answers
98 views

What tools respect `.distignore`?

You can create a plugin using the wp scaffold plugin PLUGINNAME command. It creates a bunch of files, including .distignore, .editorconfig, .gitignore, .travis.yml. Here is the contents of ....
0
votes
2answers
206 views

How can I list all installed plugins/themes/versions from CLI/API?

I would like to generate a simple text report for a Wordpress instance listing: Wordpress version plugins installed (version and whether enabled) themes and child themes installed (version and ...
1
vote
1answer
256 views

WP-CLI Get Site ID from its url

I know I can get a site list with wp site list --path="$pathtowordpress" What I want to do though is get one site's ID by knowing only it's url. Does anyone know if this is possible ? Tnaks.
0
votes
0answers
110 views

wp_remote_request does not return a response from from server when ran as Cron

Problem: wp_remote_get/wp_remote_request of a specific https target fails to return a response unless ran via WP_CLI function. $wp_remote_args => array( 'timeout' => 5, 'sslverify' =>...
1
vote
1answer
228 views

Specify custom php.ini to use with WP-CLI

I have a Linux crontab that runs a bash script. In the bash script, it executes a few wp-cli commands. I want to apply a custom php.ini file when wp-cli runs to ensure timeouts are not an issue. Is ...
0
votes
1answer
35 views

Full search and replace isn't enough to make all pictures to be loaded with https

What else should be done if I went to my sites dir in Linux and ran this command: sudo wp search-replace 'http://' 'https://' --all-tables && wp cache flush and still, some images are loaded ...
0
votes
1answer
221 views

wp-cli post create & media import issues

Been using wp-cli which I love. But i'm trying to create new posts with a clickable image and the best wp-cli does with 1 command is a featured image which is not clickable (plus featured images are ...
0
votes
0answers
34 views

Make WordPress more like Jekyll (using wp-cli package?)

I'd like to create and edit WordPress posts on my local file system and then "push" them to my WordPress blog just as if I'd added them directly from WordPress' web interface. Is there any way to do ...
0
votes
1answer
51 views

Find latest/published version of post using wp-cli

wp --ssh=barrycar@bc4 --path=public_html/wordpress --fields=ID,post_title,post_name,post_date,post_status,post_author,post_parent,post_type,filter,guid,menu_order,post_content --format=yaml post list ...
3
votes
1answer
145 views

WP-CLI alias: connect with ssh proxy

I have a wp-cli.yml file that defines an alias for a remote host: @origin: ssh: myserver.example.com path: /path/to/htdocs This would normally allow me to use wp @origin command to run remote ...
0
votes
1answer
141 views

WPCLI doesn't recognize the site

When navigating into a certain site dir in /var/www/html/mysite, I get the following WPCLI error: Error: The site you have requested is not installed. But the site is basically working and ...
0
votes
1answer
100 views

Duplicated site isn't recognized as a site

I've duplicated a site using the following code. All code worked fine until the last row (the site itself goes up on the web but the last row of code fails and I get an error): echo "Please enter the ...
0
votes
1answer
21 views

WPCLI search and replace in a particlar site dir effect another site-dir

In /var/www/html I have a site dir. I've duplicated that site's dir and db into a new site dir and db by the name of "test" (without quote marks), and changed wp-config.php accordingly. I Navigated ...
4
votes
2answers
57 views

WPCLI - update plugins, themes, and core, all in one row, instead 3 rows?

Is there a way to update plugins, themes, and core, all in one row, instead 3 rows, in WPCLI? This is the current code I use in the crontab and that I'd like to improve: 0 0 * * * for dir in /var/...
1
vote
1answer
444 views

WPCLI search and replace variants for all tables

What is the difference between: wp search-replace 'http://' 'https://' --allow-root to: wp search-replace 'http://' 'https://' --all-tables-with-prefix --allow-root AFAIU, the first search and ...
1
vote
1answer
143 views

How to rename default category name and slug using WP CLI?

Using WP CLI how can I rename default category (Uncategorized) to Blog when starting a new project? Following documentation this should be correct? wp term update category 1 --name="Blog" But I get ...
0
votes
1answer
58 views

One-click WP site generation wih wp-cli on Windows

If I run these commands sequentially in windows CMD, I get a site up and running quite quickly. wp core download wp core config --dbname=my_wp_database --dbuser=root --dbpass=my-db-password wp core ...
1
vote
1answer
106 views

Configuring WP-CLI on Windows 10

I've installed php5-cli using bash, but Wordpress is using XAMPP's PHP 7 install. I've added /mnt/c/xampp/php to the PATH, and I've explicitly used export WP_CLI_PHP='/mnt/c/xampp/php' in .bashrc. ...
0
votes
1answer
634 views

wp-cli: Error establishing a database connection: undefined constant DB_USER

Bringing this over from the wp-cli github page. I've been searching here, the docs, and the webs for several hours. Currently hosting with Blue Host and they are using version 1.2.0 :( I can't seem to ...
1
vote
1answer
1k views

Run WP-CLI using PHP

I've installed WP-CLI on the Mac and my next step is to execute WP-CLI commands using PHP script. I've tried to implement it the following way but I do not see anything happening. Can someone please ...
1
vote
0answers
36 views

Can I check which users ran which updates?

We have a site that was previously updated to 4.8.0. Two of us who normally perform updates did not have the right permissions to run the 4.8.1 update. Using wp-cli wp core update Error: Could not ...
2
votes
1answer
417 views

Can wp-cli display all users and their roles across all sites in a multisite instance?

List Multisite Users Using wp-cli(1) If I run wp user list I get a list of the users (2 admins in my case) at the top level of multisite(2). List Multisite Sites' Users I have 25 sites with various ...
3
votes
1answer
1k views

How do I run a PHP script from Wordpress environment, like `wp shell`?

wp shell is a very useful tool that lets you run PHP statements and expressions interactively, from within a Wordpress environment. It lets you use all the functions, classes and globals that you can ...
0
votes
2answers
202 views

PHPUnit via WP-CLI: Warning: Cannot modify header information … bootstrap.php:68

I'm trying to setup unit tests for a plugin I am developing. I just followed the steps at... https://make.wordpress.org/cli/handbook/plugin-unit-tests/ However, when I run phpunit I get the ...
0
votes
1answer
1k views

WP-CLI command to update all plugins and core fails when executed from cron

I have the following WP-CLI command to update all plugins and core. It seems to fail when being executed from cron (other cron commands work): 0 0 * * 0 for dir in /var/www/html/*/; do cd "$dir" &...
1
vote
1answer
276 views

How to verify a correct wp-cli installation?

I've installed wp-cli (or so I think) on my VPS, Centos 6.9. when I'm logged in as my user, wp is found; but when I run wp --info from my home directory; I receive: PHP binary: /usr/local/bin/php ...
0
votes
1answer
40 views

When installing wordpress through WP CLI mysite.com/admin not working

When I am downdloading wordpress and manually installing it, then mysite.com/admin working which opens the admin panel. But when I am insatlling wordpress using WP CLI /admin not redirecting to admin ...
1
vote
0answers
40 views

cURL to install theme

I can't figure for the head of mine how to write a cURL that would install a theme for me once I got a session. Tried binding these headers, but with no success: _wpnonce _wp_http_refferer _themezip ...
0
votes
1answer
111 views

Combine WPCLI commands for plugin installation and activation?

Instead of running the command for plugin installation and then the command for activation: sudo for dir in /var/www/html/*/; do cd "$dir" && wp plugin install elementor anywhere-elementor ...
5
votes
1answer
312 views

wp media regenerate unknown --image_size parameter

It is said in the documentation that we can set the --image_size parameter to regenerate all images for only this size. However, I am getting this for this command: Error: Parameter errors: unknown -...