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
0answers
15 views

Create Wordpress Multisite Instance Programmatically

Our CI process sets up everything from scratch, including WordPress, and our WordPress is a multisite instance. Adding a site after the Multisite functionality has been setup is easy to do ...
0
votes
1answer
24 views

How do I deactivate widgets by name?

I cna get list of widgets with wp widget list sidebar-1 | search | search-2 | 1 | {"title":""} | recent-posts | recent-posts-2 | 2 | {"title":"","number":5} | recent-comments ...
1
vote
1answer
17 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: ...
1
vote
1answer
17 views

wpcli: Error on post_content or post_title if accents

When I try to create a new post with accents width wp-cli (in windows 10 command, I got latest wp-cli) wp post create --post_title="Héllo" --post_type=page --post_content="Héllo world" I got error: ...
0
votes
1answer
12 views

How to retrieve text only from a post using WP CLI?

I have the post ids and urls. I need to extract the post content make some modifications and update again. I have more than 2,000 posts hence I would like to do it using WP CLI and not manually. Can I ...
0
votes
0answers
13 views

“New_Version” in Plugin Update is blank

When updating WP-MAILTO-LINKS, the new version is always blank. So, in my environment the update is done every night, because WP-CLI thinks, that my installaed verison is old... :(
0
votes
1answer
27 views

How to change a post attribute to homepage using WP CLI?

I want to convert a page to homepage. To add widget to homepage I need to do that. How will I be able to do that using WP CLI?
-1
votes
0answers
39 views

“Just another Fake Site site” and “Welcome to Fake Site”

Just Google the above phrases in quotes… VERY common scenario that appears to be tied to reinstalling wordpress multisite via command line. My particulars: 1) ran wp db reset Followed by: 
2) wp ...
0
votes
1answer
17 views

wp-cli PHP Notice after moving server behind load balancer

After setting up an Amazon Elastic Load Balancer, where SSL terminates, I was getting Mixed Content errors on the site, until I added the following line to wp-config.php. if (strpos($_SERVER['...
2
votes
1answer
33 views

How to run nested xargs commands?

I am trying to loop through all sites on a multisite network, and for each site, delete all subscriber users. I have tried this WP-CLI command: wp site list --field=url | xargs -n 1 -I ^ wp user ...
0
votes
1answer
26 views

How to delete a single post using wp cli in command line?

I want delete a single post using wp cli in the command line. There was some issue on one article, where my hosting disabled networking & now want me to remove the article using the console. I ...
2
votes
2answers
108 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 ...
1
vote
1answer
96 views

“Class 'Phar' not found” error setting up WP-CLI with Cygwin

I'm trying to install the WP-CLI tools as described here using Cygwin, which the guide claims is supported. When doing: cd /XAMPP/htdocs curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-...
0
votes
1answer
69 views

WP-CLI over SSH - wp command not found

I'm stuck trying to do the remote SSH with WP-CLI. I have installed WP-CLI on my Webfaction server and tested it's working # This is in server $ wp --info OS: Linux web561.webfaction.com 3.10....
0
votes
1answer
39 views

How to specify which editor is used when editing posts with WP-CLI?

On macOS, when I do wp @alias post edit 1 I get nano. The same happens when I do EDITOR=emacs wp @alias post edit 1. I want emacs, My EDITOR is set to emacs. How do I get emacs? Note that env|grep ...
0
votes
0answers
17 views

Write WP-CLI core check command to file with table structure

If I run the following in console: wp plugin list --update=available I get: +--------+--------+-----------+---------+ | name | status | update | version | +--------+--------+-----------+-------...
1
vote
1answer
21 views

wp-cli configuration in php?

https://make.wordpress.org/cli/handbook/config/#config-files is pretty good, but I'd like to have some more logic in my configuration. Is there a standard way for this? For drush I have .drush/...
1
vote
0answers
42 views

WP-CLI can't list posts

I have a WordPress Multisite (behind a firewall). I use WP-CLI for lots of things. But for some reason wp post list does not work. wp post get works. But wp post list always yields the same output, ...
2
votes
2answers
54 views

wp-cli silently fails with 255 when running wp core install

Working within a Docker container (circleci/php:latest) and I'm struggling with wp-cli a bit. When I attempt to run wp core install I get a silent failure with 255 exit code. I enabled --debug hoping ...
0
votes
2answers
27 views

Is it possible to view WP documentation within the WordPress shell?

I'm having trouble navigating the WP documentation so forgive me if this is common knowledge. Is it possible to view the documentation of classes and methods from within the shell? That is, is there ...
0
votes
0answers
51 views

bash script wp-cli search-replace 0 replacements, but command-line 3000+

I'm runnning this command; sudo -u www-data wp search-replace www.siteurl.com www.newsiteurl.com --recurse-objects --skip-columns=guid --skip-tables=wp_users From command line: 3.456 replacements ...
3
votes
1answer
101 views

wp-cli create post and media import

I would like to create a post and insert a url as an image, right now I have this, it works but creates a gallery block, instead I would just like to create a simple image block . What is the correct ...
0
votes
3answers
64 views

WP changes siteurl, but some URLs then don't work

I have a WP installation that needs moving to a new site URL. I have tried the usual methods listed on this codex. All of them produce the same problem. When I hit a link like this on the site: <...
1
vote
2answers
139 views

wp search-replace (not executing)

I'm running multisite. Looking to replace old URLs with new URLs for pulling a copy of the site form one environment to another environment. Here is my command: wp search-replace --url=domain.com ...
1
vote
1answer
63 views

Does WP-CLI support updating multiple options via a single command?

I'm looking for a way to update multiple options via a single update command. The documentation only suggests the following usage: wp option update <key> <new_value> Does WP-CLI accept ...
3
votes
1answer
67 views

Need MySQL Query or WP-CLI command to updates old URLs in Shortcodes [closed]

My client's website is moved from http to https, and I have updated most of the URLs using queries in phpMyAdmin, but I have been unable to update shortcode URLs. I have used the following query to ...
3
votes
1answer
134 views

WP-CLI Process Killed

I have around 1200 large images which I'd like to regenerate. I'm using the WP-CLI command wp media regenerate. After around 61 images are generated, the terminal shows the message Killed. Why is ...
1
vote
2answers
34 views

Removing a wordpress multisite installation and preserving the database before migrate to nginx

I have a WordPress multisite installation, and I need to remove the multisite, and keeps just the site ID 5 (domain.com/br) in the main address (domain.com). So I follow this tutorial to remove ...
0
votes
1answer
89 views

Creating a subcommand for custom wp-cli command

I'm toying around with writing custom wp-cli commands. I have successfully created a simple command, wp-cli theme save which runs a script to backup the site's theme files: <?php class ...
0
votes
1answer
63 views

Adding content from file with wp post create

I thought I had seen something like this documented where you could pipe in content to a wp-cli arg like so: wp post create --post_type=page --post_title="Blah" --post_content= < content.txt I ...
3
votes
1answer
108 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' ...
0
votes
1answer
42 views

Set Site Icon programmatically (eg. using `wp cli`)

Wordpress has a "Site Icon" feature that serves correctly-sized favicons and so on to browsers. Is there a way to drive this feature programmatically, eg. by uploading media and setting an option with ...
0
votes
0answers
32 views

Sync users from production and development environments using wp cli

I want to sync users registered at production environment to development environment. Using the below command sequence for this: 1) Find max user id at the target dev environment using: wp ...
0
votes
1answer
60 views

WP-CLI --meta-input error: Warning: Invalid argument supplied for foreach()

I'm using this code to import posts from a csv file, which works great except for the meta_input (custom fields) while IFS=$'\t', read -r col1 col2 col3 col4 col5 col6; \ do \ wp post create \ --...
0
votes
1answer
38 views

Is WP-CLI safe to use in a hosting environment? Why?

Beginner question. I am learning to use WP-CLI and I am trying to understand how/why it's safe to use. Are there any security measures I need to take when adding it to a hosting environment?
0
votes
1answer
68 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 ...
0
votes
1answer
67 views

PHP if statement with German umlauts [closed]

Im sure someone can help here pls. I have an problem with German Umlauts (ä,ü,ö) Code $wppost_interpret = $this->data['track']['itunes']['artistName']; $wppost_interpret_title = $this->data['...
0
votes
0answers
41 views

Blank character set with WP-CLI

On one of our servers, WP-CLI seems to be convinced that the character set must be an empty string. $ wp db cli mysql: Character set '' is not a compiled character set and is not specified in the '/...
0
votes
0answers
17 views

remove roles from multisite users but retain post attribution?

I work with a large multisite that uses a plugin that allows LDAP authentication. We would like to clean up roles for users who are now longer have accounts in Active Directory, just to keep things ...
1
vote
0answers
27 views

Overwrite media matching post title using WP CLI's media import command

I am trying to overwrite a media post using the WordPress CLI. The wp post create --post_type=attachment command can create an empty media item, but cannot attach an image file through WP-CLI. This ...
0
votes
0answers
47 views

Exporting CPT from dev site and import into live site?

Trying to figure out the best way of doing this with the WP CLI. Right now I'm running: wp export --dir=./tmp_posts/ --post__in=2656 --with_attachments This creates an export file, but some of the ...
0
votes
0answers
49 views

Attachments failing to import with WP CLI

So I'm transitioning a site to a new server and doing a redesign. I used the wp cli tool to export from the old site and import into the new. For some reason, a lot of the images failed to import, ...
0
votes
1answer
92 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. ...
0
votes
0answers
82 views

I can not update fields with the tax_input tag using wp cli

i'm using this command for update in command line using wp-cli tool. wp post update 12349 --meta_input='{"opalestate_ppt_parking":"2"}' --tax_input='{array('opalestate_statuschecklist' => 'rent')}'...
0
votes
0answers
18 views

Unit test for wordpress plugin

I have followed wordpress office blog -->https://make.wordpress.org/cli/handbook/plugin-unit-tests/ to implement unit testing in plugin. I have been able to write a simple test on one of my method of ...
0
votes
0answers
146 views

Can run cron event manually with WP-CLI but not with any plugin, unsure if it's being scheduled

I have a cron event that I am able to manually run with wp cron event run --all When I go to my dashboard and go to WP-Crontrol OR Advanced Cron Manager, I can see my event listed and tell it to ...
1
vote
2answers
135 views

How to specify to wp-cli for the `wp config create` (`wp core config`) command that the DB user is an 'all hosts' user?

My wp config create command: wp core config --dbname=wordpress --dbuser=wordpress --dbpass='this is not the real password' Running it: $ wp core config --dbname=wordpress --dbuser=wordpress --...
1
vote
2answers
93 views

XDG-OPEN is not recognized by WP CLI admin command

So i installed the wp admin package, but i can't seem to get her working, an error pops up telling me xdg-open doenst exist.. For install i used: wp package install git@github.com:wp-cli/admin-...
2
votes
1answer
52 views

In a continuous integration environment how do you implement the database entries for plugins and themes

I'm setting up a wordpress continuous integration environment - git->composer->bitbucket-AWS codepipeline, etc. I have yet to figure out how I automate, for the development team, the setup of the ...
0
votes
1answer
248 views

Uninstall WP-CLI

I have WP CLI installed on my server. Is there a command to uninstall the package? Here's where it's been installed on my server: I'd rather uninstall the package vs using rm -r.