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.

76 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8
votes
2answers
660 views

WP-CLI not recognizing commercial plugin updates

I'm running into an issue I haven't encountered before where WP-CLI is not recognizing plugin updates for commercial plugins. The plugin updates appear in my WordPress dashboard, but running ../wp-...
3
votes
0answers
329 views

Setting Up PHPUnit tests for WP development on Windows

I've been following the instructions in this article to try to set up some testing. I got as far as this instruction bash bin/install-wp-tests.sh wordpress_test root 'mypass' localhost latest before ...
3
votes
0answers
322 views

How to reset passwords for all users on a network using wp cli

I have a WP Network (sub directory), Sometime specially in case of security emergencies, it is generally preferred to change passwords for all users. I am looking for a way to reset passwords by ...
3
votes
0answers
241 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 ...
2
votes
0answers
210 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) ...
2
votes
0answers
611 views

ACF image field to WordPress featured image

I am working with a CPT that is using ACF fields to manage content and the hero image. With the new Archive page template, I wish to have featured images alongside the content. Earlier we did not ...
2
votes
0answers
101 views

How can I add an RSS widget using WP-CLI?

I can add an rss widget with this command: wp widget add rss my-sidebar --title=News --items=5 But when I add a URL parameter, like this: wp widget add rss my-sidebar --title=News --items=5 --url=...
1
vote
0answers
41 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, ...
1
vote
1answer
43 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 ...
1
vote
0answers
25 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 ...
1
vote
0answers
44 views

WP-CLI cron on multisite using WP-Toolkit “succeded”, but callback not executed

I'm trying to trigger WordPress crons within a multisite using Plesks WordPress toolkit. Generally it is working, but the callback doesn't seemed to be executed. The command to execute crons: /...
1
vote
0answers
37 views

How to change user admin_color with WP CLI?

I like to know how I can change a users admin color theme with WP CLI.
1
vote
1answer
233 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 ...
1
vote
0answers
181 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 ...
1
vote
0answers
126 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
0answers
43 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 ...
1
vote
0answers
46 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 ...
1
vote
1answer
32 views

Resetting internal WordPress state during its cycle

Is there any api or system to reset internal cycle? I need this, cause when I use wp-cli in the shell I need to call for instance get_header more times in one session. The fast is when I call this ...
1
vote
1answer
347 views

Error updating WP-CLI

Below is the output from my attempt to update wp-cli on Windows 10. Clearly another version is available. Can someone please explain how to make this work? C:\Users\HP>wp cli update Error: You can ...
1
vote
0answers
49 views

wp-cli fails on installing to subdomain

it's likely I missed something, but I just tried to use wp-cli to install Wordpress on a subdomain. After succesfully downloading, creating wp-config and calling the install procedure with: wp core ...
1
vote
0answers
41 views

Error: reassigning content to a different user is not supported on multisite

Objective:There's a need to remove a user from the multisite. Before doing so, user's content needs to be "transferred to another user" in a subdomain setting/specific site that's not the parent. ...
1
vote
1answer
450 views

Error when setting up phpunit tests with wp-cli scaffold

I am trying to figure out the setup for unit tests for wordpress plugins. I am using Ubuntu. So far I have: Local WordPress Installation WP-CLI up and running Installed phpunit used wp scaffold ...
1
vote
0answers
113 views

How do I add HTML code to a widget with wp-cli?

I want to add a YouTube video to a widget via wp-cli. The YouTube video is basically an iframe. When I execute the following command: wp-cli widget update text-1 --text='<iframe src="http://...
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 ...
1
vote
1answer
238 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 ...
1
vote
0answers
274 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 ...
1
vote
1answer
332 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
vote
0answers
262 views

Update BackupBuddy with WP-CLI

I've written a script that basically loops through all of the WP sites on our server and updates everything: core, plugins, themes. It does, however run into one issue: It will not update BackupBuddy....
0
votes
1answer
32 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
14 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 | +--------+--------+-----------+-------...
0
votes
0answers
40 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 ...
0
votes
1answer
63 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
40 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
25 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
35 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
0answers
39 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
15 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 ...
0
votes
0answers
43 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
47 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
90 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
79 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
123 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 ...
0
votes
1answer
64 views

Install plugin on remote wordpress

I want to install a plugin using wp-cli (or anything else) on a WordPress based website. I have URL, admin-user, admin-pass only. (no FTP/ssh). I want to do it programmatically, without going into the ...
0
votes
0answers
69 views

WP-CLI is unable to update password

I execute following command to change password for admin user from command line: wp user update admin --user_pass="mynewpassword" --allow-root I got following error message: WordPress database ...
0
votes
0answers
22 views

Faster Unit Testing in WordPress?

I'm using WordPress Unit Testing to develop a plugin. The Unit Testing is the one provided by WP-CLI with the wp scaffold plugin-tests command: https://make.wordpress.org/cli/handbook/plugin-unit-...
0
votes
1answer
200 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 ...
0
votes
1answer
70 views

Is it possible to use WP-CLI in a plugin (or theme)?

Is it possible to use WP-CLI in a plugin (or theme)? Such as $ret = \WP_CLI::execute('plugin list'); I want to use some subcommands from other plugins.
0
votes
0answers
115 views

WP-CLI with cPanel WHM root, where users do not have shell access

I'd like to run wp-cli for a bunch of WP installs that live in separate cPanel accounts, all under a WHM with root. System is CentOS6. I'd rather not give the user accounts shell access. Wp-cli ...
0
votes
0answers
34 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 ...