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.

106 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
0answers
443 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 ...
4
votes
0answers
648 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) ...
3
votes
0answers
641 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 ...
2
votes
0answers
83 views

Regenerate thumbnails unexpected resolution (96 x 96)

I'm using WP CLI wp media regenerate to resize my thumbnails. I've noticed something a bit weird. The original image I upload is a JPEG with a resolution (DPI) of 72. The images that are generated ...
2
votes
0answers
104 views

How to get all posts related to a term with WP-CLI?

I want to get all french brands. When I try with post type brand, it works (for example it returns 1000 results). wp post list --post_type=brand If I add a parameter: taxonomy term (--<taxonomy>...
2
votes
1answer
114 views

How can I list only sites that use a particular theme or plugin?

I need to search through dozens of WordPress multisite (network enabled) installs for sites that use a particular plugin. How can I list only sites that use a particular theme or plugin, preferably ...
2
votes
0answers
103 views

WP WPQuery, not running properly in WP CLI

I'm running a simple query just to find simple WooCommerce products, here is the query which works fine in the header of the site: $args = array( 'post_type' => 'product', 'posts_per_page' =...
2
votes
0answers
273 views

WP CLI: there has been critical error

I am using Wordpress 5.3 minimal installation and currently have not installed any other plugins. I have installed WP CLI and below is the output of wp-info: OS: Linux 5.0.0-1025-gcp #26~18.04.1-...
2
votes
0answers
787 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
115 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
17 views

How can i preserve wordpress database encoding after using wp-cli search-replace with --export flag?

I need to migrate a wordpress database to another server but first i need to change all old url's, stored inside any table, to new ones. To do that, i'm using wp-cli search-replace function with --...
1
vote
1answer
77 views

WP CLI not finding plugin commands

On a Ubuntu 20.04 Linode I have a Wordpress installation. I deploy the website using https://github.com/Mixd/wp-deploy, a Capistrano deployment tool. When the website is deployed the folder structure ...
1
vote
0answers
30 views

Getting page output HTML without request (for CriticalCSS, PurgeCSS)

I work a lot with legacy website with css files which were shared across many pages which resulted in really bloated stylesheets shipping to browser. I want to do some performance tricks to avoid this ...
1
vote
0answers
141 views

wp-cli command throws error : "SSL routines:tls_process_server_certificate:certificate verify failed" while querying https website

I use wp-cli with wp restful plugin installed. Running wp cli command wp rest user list --http=https://[url] throws below error: Error: Failed to get url '[url]': stream_socket_client(): SSL operation ...
1
vote
0answers
500 views

wp search-replace on database returns PHP fatal error: Array and string offset access syntax with curly braces is no longer supported

So I need to setup a client website locally for improvements. I'm trying to search and replace any instances of the live site's name/url and replace it with a development one. When I run the command: ...
1
vote
0answers
124 views

How can I search and replace by post type?

I am trying to use WP-CLI to do a search and replace on about 10,000 posts that were imported from another CMS and it has a great deal of old inline styles and spans and such. I would like to be able ...
1
vote
1answer
149 views

WP CLI not outputting anything

I am trying to use wp cli command line tool, but like many others it doesn't work for me. The site itself is loading with no issues. getting info does work: $ wp cli info OS: Linux 5.4.0-54-...
1
vote
0answers
249 views

Only the WP CLI command, wp --info, runs under my cPanel account

Please review the following commands I have issued remotely to the Bash Shell on my dedicated cPanel/WHM server: [root@host ~]# wp cli update Success: WP-CLI is at the latest version. Then I ...
1
vote
0answers
376 views

How to use WP-CLI / WC-CLI to bulk import 1000s of products (variable and simple)?

I am a junior developer and I have been asked to work on a wordpress site that has previously been using All Import plugin to upload products. The problem is, this is not functioning properly, and is ...
1
vote
0answers
437 views

How to delete 1000s of duplicated images in Wordpress?

We kinda have a wired problem that took me weeks of searching and testing, the problem is that while working on one of my client's Wordpress website I noticed that there are around 75k images in ...
1
vote
0answers
36 views

Update a post based on results from GET request to another server

I need to use GET requests to retrieve the current status of a device and then update the body of a specific Wordpress post with the text data sent by the external device (for reference, it will use ...
1
vote
0answers
117 views

WP-CLI search-replace posts content for certain URLs

Using WP-CLI I am wanting to search and replace posts content but only for certain URLs. This is what I have so far: $ wp search-replace 'Contact us today' 'Contact us today by filling in the form ...
1
vote
1answer
47 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 ...
1
vote
3answers
659 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 ...
1
vote
0answers
131 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
81 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
69 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
2answers
971 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!
1
vote
0answers
310 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

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
75 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
36 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
0answers
70 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
1answer
129 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
0answers
166 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
47 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
262 views

WP CLI Core install - blank database

A very strange thing has started happenning with my local WP installs... I am using latest version of MAMP Pro, and running: wp core install --url="http://example.local" --title="example" --...
1
vote
1answer
374 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
362 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
0answers
382 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
0answers
24 views

Trying to install/configure wp-cli for WordPress

I'm trying to install/configure wp-cli for my WordPress website but I keep getting an error everytime I try and run a command. I have a VPS server with Bluehost and I followed a simple installation ...
0
votes
0answers
21 views

Using the WP CLI to output the HTML results of calling a post?

I’ve inherited a strange site, where the posts in the backend are built not in the WP editor, but in a series of ACF repeater blocks. I need to format / migrate these posts in a way that they can be ...
0
votes
0answers
25 views

DB option update with wp-cli

I am creating an automation script where I use wp-cli to do plugin/theme installations, configure settings and other. This script is installing the Enfold Parent and Child theme from Kriesi and after ...
0
votes
0answers
63 views

wp-cli + valet: "Error establishing a database connection"

I'm running Laravel Valet to get a simple WP local development environment. Strangely at some point wp-cli stops being able to do much and gives me a "Error establishing a database connection&...
0
votes
0answers
63 views

wp option get blogname --url=my-sub-site.com returning main site option

I have a multisite setup with some 14 woocommerce sites. site_id | domain 1 | local.mainsite.com 2 | local.subsite-2.com 3 | local.subsite-3.com 4 | local.subsite-4.com I want ...
0
votes
1answer
77 views

Working with CLI and missing my namespace classes inside

I'm very new to WordPress development. I hit this error when i developering my own class and namespace to do the life easier to reuse my code on cross of platforms/frameworks. I have added my CLI ...
0
votes
1answer
42 views

wp-cli error: "Term is missing a parent"

When I try to export posts via the command line, I get an immediate error that the term is missing a parent: $ wp export Starting export process... Error: Term is missing a parent: name-of-tag (123) ...
0
votes
0answers
23 views

WP CLI custom plugin commands not available on production server

I have WP All Import on one website and I've realized that WP CLI doesn't load the plugin custom commands. It's not related to WP All Import though, because there should be even other plugins commands ...
0
votes
0answers
33 views

How to automate creating pages on a hosted wordpress from a local set of folders?

I have a set of folders on my computer (mac) with a txt file and several photos, and I want to make a page out of each folder's content on my hosted wordpress. I think I understand how this is ...
0
votes
0answers
20 views

WPCLI spits out huge amounts of unneccessary information

When I run some common 'wp' commmands, I typically get huge amounts of information that seems unlrelated to my intent. For example, if I do 'wp plugin list' I get a screenflood, a segment of which ...