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

POT file generated using WP-CLI does not retrieve strings from translation functions with FQN (Qualifier)

I am generating .pot files by using the WP-CLI command above: wp i18n make-pot ... It works well, but it does not retrieve strings from translation functions with FQN (Qualifier). Example: \__( 'This ...
user avatar
0 votes
1 answer
38 views

When might you need to specify the "url" argument/option in WP-CLI?

I have read several blog posts and discussions about the url option in WP-CLI and have seen many different opinions and interpretations, so I assume I'm not alone with this question... The official ...
user avatar
0 votes
1 answer
19 views

What is the purpose of the "user" global parameter in wp-cli.yml config?

According to WP-CLI documentation, you can specify "user" using inline arguments, or in the global configuration. I understand there might be a task you want to run against a specific ...
user avatar
0 votes
0 answers
16 views

WP-CLI Add category as menu item main-menu

I've found this documentation about adding terms using WP CLI: https://developer.wordpress.org/cli/commands/menu/item/add-term/ and tried to find out how I can add an existing category to the main-...
user avatar
0 votes
0 answers
20 views

WP-CLI: Does "wp post create" will create post normally and will ping to Ping Service?

Is post created using WP-CLI is just a normal post that will ping to Ping Service? I scared if Ping Service not triggered on my new post using WP-CLI.
user avatar
  • 191
0 votes
0 answers
24 views

WP-Cli Error When Mapping Multisite Subdomain

I have a multisite located at example.com which has a subsite located at subsite.example.com. I followed the official Wordpress.org documentation to map subsite.example.com to otherexample.com https:/...
user avatar
  • 143
0 votes
0 answers
22 views

Bulk update published posts date randomly using wp-cli?

I see an option ([--post_date=<post_date>]) in wp-cli, but how can we use wp-cli to update all my published posts date randomly? For example, I want all posts date changed randomly between 01-01-...
user avatar
  • 1
0 votes
1 answer
39 views

wp_clear_object_cache() is deprecated. What should I use instead?

Today I noticed that \WP_CLI\Utils\wp_clear_object_cache() has been marked as deprecated in WP-CLI 1.5.0. The release notes don't mention anything about it. What should be used, instead? Do I still ...
user avatar
  • 536
0 votes
0 answers
53 views

Wordpress Import (CLI) returns Error Establishing a database connection

I am trying to use the wp import cli in the terminal to import a large wxr file (200MB) from the old test server to new test server. I can login to wp-admin using the admin account and mysql cli mysql ...
user avatar
2 votes
1 answer
32 views

Setting boolean and array values using wp theme mod set

I need to set a couple of Theme Mods to boolean and array values using WP CLI but can't find any way to do achieve it. I have already tried the following for booleans, but they appear to be treated as ...
user avatar
1 vote
1 answer
29 views

How to find what pages/posts contain a particular reusable block?

How can I find out what pages and post on a site contain a particular reusable block? Typically, to find content on a site, I issue wp db search *itemlookingfor* (like the post ID, part of a file name,...
user avatar
  • 545
1 vote
1 answer
99 views

When WP_CLI runs Wordpress from the command line, are hooks called?

Yesterday, I found out that a website I worked on as a writer (I have no admin access) had been injecting malicious Javascript code in all its pages, as described in this article by Luke Leal. ...
user avatar
0 votes
2 answers
169 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 ...
user avatar
0 votes
0 answers
66 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 ...
user avatar
0 votes
1 answer
134 views

Using WP-CLI, how do I delete a post by title or slug, not ID?

The docs show how to delete by ID. How do I delete by slug/title?
user avatar
  • 455
0 votes
0 answers
38 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 ...
user avatar
0 votes
0 answers
48 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 ...
user avatar
1 vote
0 answers
34 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 --...
user avatar
  • 121
1 vote
1 answer
382 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 ...
user avatar
0 votes
1 answer
142 views

WP CLI: search and replace specific directory name of URL

I am trying to use wp cli (with regex) to search and replace. I want to change: domain.com/wp-content/uploads/2020/04/asdnbahsdjhgzw/picture.jpg to domain.com/wp-content/uploads/2020/04/picture.jpg So ...
user avatar
  • 3
1 vote
1 answer
149 views

Get last published post in Wordpress using wp-cli

I'm using below wp-cli command to get latest post ID: wp post list --order='DESC' --orderby='ID' --field='ID' | head -1 This, however is inefficient as all posts are retrieved from DB and then head ...
user avatar
  • 225
0 votes
0 answers
147 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&...
user avatar
  • 6,786
1 vote
1 answer
215 views

WP Cli will not execute on Windows

I have tried to install Wordpress CLI on my windows machine running windows 10. But for some reason everytime i try to run the wp Command it says 'sh' is not recognized as an internal or external ...
user avatar
0 votes
0 answers
139 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 ...
user avatar
0 votes
1 answer
203 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 ...
user avatar
0 votes
1 answer
85 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) ...
user avatar
0 votes
0 answers
37 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 ...
user avatar
0 votes
1 answer
38 views

adding wp-cli commands to plugin: how to document to users?

I'm adding wp-cli support to a plugin of mine. Is there an accepted way of letting my users know they can use wp-cli with my plugin? I can put stuff in my readme.tx of course, and I can put an ...
user avatar
  • 467
1 vote
0 answers
37 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 ...
user avatar
  • 11
2 votes
0 answers
100 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 ...
user avatar
  • 1,923
2 votes
1 answer
73 views

Does thumbnail regeneration edit the database?

I'm using the WP CLI command wp media regenerate to resize all of the images via the /wp-content/uploads directory. Are the new image dimensions registered in the database in any way or does the ...
user avatar
  • 1,923
0 votes
1 answer
101 views

WP-CLI media import error

I'm trying to import a JPG to my uploads folder using WP-CLI (macOS). I'm connected to the server, I can update and activate plugins, successfully navigate to all folders, etc. However, when I run: wp ...
user avatar
1 vote
0 answers
243 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 ...
user avatar
  • 225
0 votes
0 answers
34 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 ...
user avatar
2 votes
1 answer
325 views

Get WP CLI to hide debug warnings and notices in JSON output, same setting as website

Summary: WP CLI can be used to get a JSON output of all the plugins installed on a site, but the output gets corrupted due to warnings although log levels are set to low. Problem Unfortunately, I have ...
user avatar
1 vote
2 answers
156 views

Formatting messed up when piping wp commands

Ok, so I have been using wp plugin update --all in the past with a tee command. There has been no problem in the past, but after I ran an update on my system, everytime I run the command through a ...
user avatar
1 vote
0 answers
651 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: ...
user avatar
  • 11
0 votes
0 answers
306 views

call to undefined function mysql_connect

Trying to run a search and replace but am getting an error Call to undefined function mysql_connect() in E:\xampp\htdocs\test\wp-includes\wp-db.php:1688 I have checked my WP files and have both ...
user avatar
1 vote
1 answer
85 views

WP CLI Get all Enqueued Scripts and Styles

Normally, I would hook into the wp_enqueue_scripts action in order to gather a list of enqueue'd scripts and styles. However, I have a very intensive process I need to run, thus instead of running it ...
user avatar
  • 139
2 votes
0 answers
190 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>...
user avatar
  • 121
1 vote
1 answer
382 views

How do you kill WP-CLI execution?

I am experimenting with WP-CLI on Windows 10 and XAMPP. I probably don't understand how it works, because I expected stopping Apache from the XAMPP Control Panel would stop WP-CLI script execution on ...
user avatar
  • 42
0 votes
1 answer
463 views

Logs for WP CLI

I am running a WP CLI script to regenerate images, seq 192000 194000 | xargs wp media regenerate —only-missing and i got errors, example: Warning: Can’t find “margot-fox-pope-francis-post” (ID 204823)....
user avatar
1 vote
0 answers
258 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 ...
user avatar
0 votes
0 answers
20 views

Media Library Cleanup A Thought Exercise

I have a site with roughly 1200 posts. Each post has a featured image and a few placed images in the content. Over the years we have had a bad habit of using the WordPress image editor to crop and ...
user avatar
1 vote
1 answer
281 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-...
user avatar
  • 111
1 vote
1 answer
790 views

Can't generate pot file using wp cli

I'm developing a child theme and I want to get .pot file using wp-cli. I follow the wp-cli handbook and run: cd /media/sf_TOOLS/ubuntu-20.04/bin curl -O https://raw.githubusercontent.com/wp-cli/builds/...
user avatar
  • 131
0 votes
0 answers
76 views

Theme Customization with WP CLI

It seems we cannot say Hi here, However, I search on the documentation, and the github, however i don't find any information about customization of theme through WP CLI. Is it possible to do the same ...
user avatar
  • 1
0 votes
0 answers
38 views

WP-Cli Autoloads Non-existant Framework

When I run wp version --debug it shows that the bootstrap framework is being autoloaded and missing files... when in reality after tested bootstrap and decided not to use it... I completely removed it ...
user avatar
  • 143
4 votes
2 answers
192 views

Prompt user for input in WP CLI

I am missing some feature to prompt the user for input. In Laravel we have $this->ask('What is your age') (https://laravel.com/docs/8.x/artisan#prompting-for-input) I haven't been able to find any ...
user avatar
  • 396
0 votes
1 answer
127 views

Mocking WP_CLI static methods in unit tests

I'm writing unit tests (not integration) for a lib I'm working on. There, we created some WP-CLI commands that I'd like to test. Most of them are just renaming things, copying and pasting things over ...
user avatar
  • 1,954

1
2 3 4 5
8