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
0 votes
1 answer
433 views

Wordpress speed slow after .5 million single image post via wp-cli

I am trying to Creat Wordpress website that will contain 10 Million post, such that when i upload a single its become a post with it's own name as title. and i am importing these images with Wp-cli. ...
Shoabch's user avatar
29 votes
6 answers
13k views

Running WP Cron on multisite the right way

I have WordPress Multisite with several sites. I set up DISABLE_WP_CRON to true in my wp-config.php. If we set up cron task with wget or curl we have 30 sec rule to execute PHP script. It's so small ...
Kolya Korobochkin's user avatar
23 votes
4 answers
8k 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 However, ...
lalo's user avatar
  • 531
15 votes
1 answer
3k 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 ...
jgraup's user avatar
  • 9,699
9 votes
4 answers
10k views

wp-cli displays php notices when display errors off

I am using wp-cli and I am having php notices and errors show up when running wp-export. Some of these warnings and errors are ending up in the output file. How can I force errors to NOT show up. I ...
Chris Muench's user avatar
1 vote
1 answer
555 views

WP CLI - show users whose ID is larger than given ID

The below code achieves what i need for given ID = 200. wp user list --role='customer' --orderby=ID --order=asc | awk 'FNR == 1 {next} $1>200 {print ;}' How to do it with wp user list and WP ...
rok's user avatar
  • 224
44 votes
4 answers
38k 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 ...
the's user avatar
  • 1,407
11 votes
1 answer
8k 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 ...
user658182's user avatar
8 votes
1 answer
3k 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? ...
Kit Sunde's user avatar
  • 371
6 votes
1 answer
11k 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 ...
WKL's user avatar
  • 63
6 votes
1 answer
3k views

How to update an 'array' option using wp-cli [duplicate]

I'm trying to write a bash script to automate the syncing of a live site to a dev site. I have the basics figured out, like exporting the production db and importing / updating urls in the dev site, ...
passionsplay's user avatar
5 votes
3 answers
3k 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 ...
prosti's user avatar
  • 4,253
5 votes
1 answer
649 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 ...
jgraup's user avatar
  • 9,699
4 votes
2 answers
3k 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: +-----------------------+--------------------...
Mike Lyons's user avatar
4 votes
2 answers
6k 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?
abaporu's user avatar
  • 143
4 votes
2 answers
4k views

"Could not open input file" error even when WP-CLI is in the path

I'm developing Wordpress locally with XAMPP, and currently trying to install the WP-CLI tools as described here using Cygwin. I renamed wp-cli.phar to wp, made it executable and moved it to the ...
Hashim Aziz's user avatar
4 votes
3 answers
6k views

Change old URLs after the domain change

I have setup wordpress on my server, and after some time I've changed the domain name of the installation. However, all of the old urls within the site point to the old domain. How can I change old ...
Gitnik's user avatar
  • 169
3 votes
1 answer
2k views

WP-CLI How to generate a list of posts with corresponding meta values

I created this SQL query to generate a list of posts (which I will use for a CSV Sheet) SELECT p.ID, p.post_content, p.post_title, pm1.meta_value as 'Amazon.com', pm2.meta_value as 'Amazon.co.uk' ...
dean2020's user avatar
  • 251
3 votes
1 answer
5k views

PHP warning are displaying when using WP CLI [closed]

I'm running WP CLI 0.25.0 on Debian, PHP 7.0. I keep getting the PHP warnings displayed. In php.ini used for cli I have set error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING ...
Marin Bînzari's user avatar
2 votes
1 answer
1k 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 '...
Ben Cole's user avatar
  • 505
1 vote
1 answer
613 views

How do I update a nested option?

I use this command to get values of ez-toc-settings->auto_insert_post_types wp eval "print_r(get_option('ez-toc-settings')['auto_insert_post_types']);" and this prints out the correct values: ...
yarek's user avatar
  • 127
1 vote
2 answers
1k views

Is it possible to use WP-CLI via PHP-framework?

I have Zend framework 2 application (PHP), via which I want to use WP-CLI functionality. near Zend project I have WordPress project, which I want to maintain from Zend via WP-CLI. I see in the docs ...
Sergey Kondrushenko's user avatar
1 vote
2 answers
1k 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/...
jgraup's user avatar
  • 9,699
1 vote
2 answers
226 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 ...
codecowboy's user avatar
  • 1,758
0 votes
1 answer
865 views

Trying to install Wordpress on WSL Windows 10, and running into issues with wp-cli and "wp db create"

Okay so I'm following this tutorial: https://hellojason.net/blog/how-to-setup-wordpress-locally-on-windows-subsystem-for-linux/ I had to do a bunch of monkey around to get MySQL to work because for ...
Aslan French's user avatar
0 votes
2 answers
663 views

Update custom plugin with WP-CLI

I made a custom plugin for inserting staging / production versions of a Google Tag Manager container based on the server's IP address. How do I make it compatible with WP-CLI so it will update when I ...
whakawaehere's user avatar