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.

Filter by
Sorted by
Tagged with
2 votes
1 answer
308 views

Allow download_url for lan addresses

I'm hosting a wp site on my own server (at home) and I would like to use wp cli to import media from my own computer. On my computer, I have a web server and I asks to wp-cli to import media from "...
user avatar
0 votes
1 answer
609 views

WP Cli - post add meta in xargs after wp post generate - add multiple fields

This command will generate posts and create a field with key "bar" and value "foo" wp post generate --format=ids --count=10 | xargs -d ' ' -I % wp post meta add % foo bar This does not seem to work: ...
user avatar
  • 715
1 vote
1 answer
705 views

How to use wp db export and import together?

When I use WP-CLI I'm having some issues with the wp db export and wp db import commands. I have a local site on my desktop that I would like to migrate to my laptop so I can work on it. So I go on ...
user avatar
  • 11
1 vote
2 answers
1k views

Bulk remove custom post type and its attachments with wp-cli?

I have a custom post type called "meetings" and I will like to bulk remove all the posts and all of its attachment images... Can this be done with the wp-cli? thank you!
user avatar
  • 23
0 votes
1 answer
50 views

Userless db-only wordpress instalation

Hello how I can perform a wordpress installation without the need to create users. I want to just run a command and just install the database. I want the user to get installed via gui when cli install ...
user avatar
0 votes
0 answers
101 views

Limit a user only to wp-cli only use

I have developed a docker wordpress solution and it uses wp-cli to do the required installation from shell. The installation itself required a user to get generated therefore I create a default admin ...
user avatar
0 votes
1 answer
92 views

Automate WordPress website setup with prefilled data

I'm asked to write documentation explaining how to set up a website to run exactly as the live environment does right now. The website is dependent on WPML, certain categories and menu's being ...
user avatar
0 votes
0 answers
22 views

How come there is no error if I upgrade WordPress core after locking .htaccess permissions to 644?

How come there is no error if I upgrade WordPress core after locking .htaccess' permissions to 644? I upgrade WordPress this way basically: wp plugin update --all wp core update wp language core ...
user avatar
6 votes
2 answers
2k views

wp-cli commands do nothing, return nothing

I'm using wp-cli 1.5.1. My server is running php7.2. I'm not running suhosin. (Some people seem to think that suhosin may cause the same symptom) When I issue wpcli commands within a non-wordpress ...
user avatar
  • 237
4 votes
0 answers
776 views

What could cause WP-CLI search-replace to not replace all instances of a string?

We're migrating a site from dev to production using wp-cli to replace all occurrences in the database for the url, just like in the search-replace example. (http://example.dev to https://example.com) ...
user avatar
0 votes
1 answer
324 views

WP-CLI - How to install a plugin from a remote server

I'm trying to install a plugin that i downloaded and i host on my server inside a vagrant box to use locally. I'm running this command to try to install it: wp plugin install https://example.com/...
user avatar
  • 167
3 votes
2 answers
578 views

Revert WordPress default options after a PHPUnit test has run

tl;dr: is there a way to make changes to WordPress options during a PHPUnit test suite execution, and have the changes reverted to the WordPress defaults before the next test suite is executed, ...
user avatar
  • 625
14 votes
3 answers
3k views

How I prevent a plugin to be loaded when doing WP-CLI?

I currently use this code in the main plugins file itself. But that plugin is not my own so I would prefer to be able to upgrade it normally without every time adding this code. if ( defined( 'WP_CLI'...
user avatar
0 votes
1 answer
212 views

How to destroy all user sessions via WP-CLI

In installed WP-CLI v1.5.0 I ran wp --info and it return the correct info. I then ran wp user session destroy user1 --all and got this: CORRECT>w user session destroy prvweb -all (y|n|e|a)? ...
user avatar
0 votes
2 answers
294 views

WP CLI can't delete plugin related table

I have installed a plugin following wp plugin install ... CLI command and then activate through CLI command its working properly. But problem is that when I deactivate then delete the plugin the table ...
user avatar
0 votes
1 answer
4k views

Why doesn't 'wp' command work in my WP-CLI installation?

The wp-cli.phar file is in the same directory from where I test the wp command. But it says the command doesn't exist. When I'm trying to see if WP-CLI is installed with the php wp-cli.phar --info ...
user avatar
0 votes
1 answer
860 views

Update the permalink for one post via wp cli

I'm using WP-CLI to import articles from a non-WordPress system. The legacy system has a custom URL defined for every post. I'd like to be able to set the permalink on the posts I'm importing base on ...
user avatar
4 votes
3 answers
209 views

Disable comment windows for all existing posts (pages/blogposts)

Is there a WP-CLI command to disable comment windows for all existing posts (pages/blogposts)? I ask this since when I change a theme for a site I have, all pages in that site getting their comment ...
user avatar
0 votes
1 answer
32 views

Do all WordPress installations include WP CLI by default

Does the standard WordPress installation include WP CLI? So if someone install WordPress on their website does it automatically include WP CLI?
user avatar
  • 337
0 votes
0 answers
61 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 ...
user avatar
1 vote
2 answers
1k 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 ...
user avatar
  • 987
11 votes
1 answer
999 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? ...
user avatar
  • 638
0 votes
1 answer
168 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 ...
user avatar
  • 113
3 votes
1 answer
147 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: ...
user avatar
  • 130
0 votes
0 answers
63 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 ...
user avatar
  • 166
1 vote
1 answer
958 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 +...
user avatar
1 vote
0 answers
376 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 ...
user avatar
2 votes
2 answers
1k 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 ...
user avatar
0 votes
1 answer
331 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 ...
user avatar
1 vote
1 answer
85 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 ...
user avatar
4 votes
1 answer
1k 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 ...
user avatar
  • 1,343
3 votes
1 answer
753 views

Shortest possible shell script to install WordPress on Nginx server?

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 ...
user avatar
1 vote
1 answer
453 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 ...
user avatar
23 votes
8 answers
20k 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 ...
user avatar
0 votes
2 answers
401 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 ...
user avatar
0 votes
0 answers
168 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?
user avatar
  • 34
5 votes
1 answer
3k 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-...
user avatar
  • 1,954
2 votes
1 answer
883 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 ....
user avatar
  • 595
0 votes
2 answers
2k 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 ...
user avatar
3 votes
1 answer
1k 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.
user avatar
1 vote
1 answer
707 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 ...
user avatar
  • 113
0 votes
1 answer
124 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 ...
user avatar
1 vote
1 answer
682 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 ...
user avatar
0 votes
0 answers
45 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 ...
user avatar
0 votes
1 answer
352 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 ...
user avatar
2 votes
1 answer
696 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 ...
user avatar
0 votes
1 answer
1k 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 ...
user avatar
0 votes
1 answer
147 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 ...
user avatar
0 votes
1 answer
30 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 ...
user avatar
3 votes
2 answers
69 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/...
user avatar

1 2 3
4
5
8