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
13 views

WP-CLI delete customers in bulk

I have a staging site and need to give an access to developers. So, I have to delete all customers just in case. I have below command. But I feel there should be better command. Can you advise? wp ...
Burak's user avatar
  • 1
0 votes
0 answers
16 views

Does wp i18n CLI has a prototype of "update-json" file?

I correctly internationalized a javascript file from wp theme folder. Now I would like to know if Wordpress team plans to propose a CLI to update json without losing existing translation. It seems ...
imagIne's user avatar
  • 45
0 votes
0 answers
79 views

WP-CLI PHP Deprecated Warning

Under WordPress 6.3, PHP 8.2, MySQL 8.0.34, WP-CLI 2.8.1, for wp command like this: wp post list --post__in=mypostid I have this warning: Deprecated: Creation of dynamic property Post_Command::$...
Brethlosze's user avatar
2 votes
1 answer
24 views

WP CLI switching post status from publish to future not working?

I want to use wp cli to change post status from published to future, however it appears that once a post is published, it can no longer be switched to future. When I try to do this the post remains ...
user2491463's user avatar
1 vote
1 answer
49 views

How can I use xdebug with wp-cli

I'd like to use xdebug and vscode to debug a script I'm running via wp eval-file. My launch.json is pretty basic. { "name": "Listen for Xdebug", "...
JJS's user avatar
  • 121
0 votes
1 answer
108 views

Warning: Constant WP_DEBUG already defined

PHP 8.1.17 WP-CLI 2.7.1 WP set up as multisite network Adding the following line to wp-config.php (line 107)… define('WP_DEBUG', true); …causes wp-cli to report the following… $ wp plugin list ...
aslamK's user avatar
  • 11
0 votes
1 answer
94 views

Run a WP-CLI command from within PHP without using shell_exec()

Is there another way for me to run a WP-CLI command from within a PHP script other than using the shell_exec() function.
TKEz's user avatar
  • 111
-1 votes
1 answer
50 views

Should I run wp cron event run via crontab or as a daemon?

In my server I've run: sudo -u www-data wp cron event run --path=/var/www/blog.example.com --all But I do not know should I run wordpress cron using crontab or make it into a service using systemd ...
Dimitrios Desyllas's user avatar
0 votes
0 answers
20 views

Trying to remove all references from old domain in wordpress site after migration to new domain

I have moved a website from old domain to new domain and have used the following WP CLI command $ wp search-replace --skip-columns=guid "olddomainname.com" "newdomainname.com" ...
Kiwiheretic's user avatar
0 votes
1 answer
155 views

'wp' is not recognized as an internal or external command, operable program or batch file

I can't get WP-CLI to run on Windows. Downloaded https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar to c:\wp-cli\wp-cli.phar, Added c:\wp-cli\ to the System & User Path ...
Steve's user avatar
  • 1,677
0 votes
1 answer
106 views

What is the correct way to implement wp-cron server-side in Kubernetes?

I'm not sure if this is the correct place to ask the question, but since this is specific to deploying WordPress, I thought I'd ask here first. What is the correct way to implement wp-cron server-side ...
JakGuru's user avatar
0 votes
0 answers
43 views

Transitioning a big blog to WEBP images

I have a Wordpress site with a LOT of posts that still get significant amount of traffic (10,000's of posts). The site is image heavy and uses <img> tags for inline Jpegs as featured and inline ...
gravy's user avatar
  • 157
1 vote
1 answer
159 views

Batch Replace URLs in Wordpress Database

I will be using this command with WP-CLI to batch change about 1,000 URLs. while IFS=, read orig new; do wp --dry-run --skip-themes --skip-plugins search-replace "$orig" "$new" ...
JoaMika's user avatar
  • 658
1 vote
1 answer
96 views

wp media regenerate says "no regeneration needed" whe that's no the case

I'm trying to generate thumbnails for a PDF attachment. Right now in the uploads/ folder there is only the PDF file, no image thumbnails related to it. But when I run the regeneration with : wp media ...
mike23's user avatar
  • 5,931
0 votes
1 answer
28 views

Disappearing plugins

I've had a problem with disappearing plugins lately. Several of my plugins are installed and are working, but you can't see them in the admin plugin interface, only WP-CLI. The plugins are "...
scott8035's user avatar
  • 210
0 votes
2 answers
47 views

Post Count for Multisite?

Is there a way to get post count for all active sites on a multisite, using WP-CLI? Conceptually, I'm looking for a combination of wp post list --format=count and wp site list --format=count but I don'...
whakawaehere's user avatar
0 votes
0 answers
153 views

is it possible to use wp cli to export custom post types

i have been trying to use WP CLI to export custom post type 'product' from custom taxonomy 'product_brand'. however, my command is exporting a random list of products, from other brands. it also is ...
challenge2022's user avatar
0 votes
1 answer
68 views

wp cli media commands not working

I am trying to bulk update media file captions through WP CLI so i can attribute image creators. My command is as follows: wp media list --date="2022-02-24" --format=ids | xargs -n 1 wp ...
challenge2022's user avatar
1 vote
1 answer
29 views

Why doesn't "wp db cli" enable tab completion?

I would like to use tab completion when using the MySQL REPL accessed by running wp db cli. However it doesn't seem to work, even though my ~/.my.cnf file contains this content: [mysql] auto-rehash ...
Flimm's user avatar
  • 674
1 vote
0 answers
30 views

Why not attaching images after impoting using wp cli

I want to move posts from one site to another, because of the big amount of posts I am trying with wp-cli import. The destination site also has huge amounts of posts, now when I am importing XML files....
Mi2's user avatar
  • 11
2 votes
0 answers
195 views

Using wp-cli on remote with quoted commands

I have my wp-cli.yml configured with a working ssh connection. If I wp db query "CHECK TABLE $(wp db tables | paste -s -d, -);" and run locally it works just fine. On the other hand, if I wp ...
Tom Ransom's user avatar
-1 votes
1 answer
201 views

Weird WP -Cli Error Connection Refused

I have a rather of wp-cli problem. I am using wp-cli to import a db from my test server into my staging server and even though the import is successfully and everything seems to be working correctly ...
mjones's user avatar
  • 153
0 votes
1 answer
130 views

Can WP-CLI modify database connection details in existing wp-config file?

I am aware of WP-CLI's many database interaction functions via "wp db" and its functions for generating wp-config files via "wp config" - However I cannot find a way of using WP-...
mayersdesign's user avatar
1 vote
1 answer
108 views

Does DISABLE_WP_CRON prevent plugins from registering new cron tasks?

If I set DISABLE_WP_CRON to true in my wp-config.php file, then will it block plugins from registering new cron events (eg with calls to wp_schedule_event()) define( 'DISABLE_WP_CRON', true ); I've ...
Michael Altfield's user avatar
2 votes
1 answer
83 views

How to install WordPress with Composer?

I want to install WordPress and WP CLI both with Composer. This is how I install Drupal and Drush (Drupal's CLI tool) with Composer: cd WEB_APPLICATION_ROOT composer create-project drupal/recommended-...
yoine's user avatar
  • 21
1 vote
0 answers
70 views

wp-cli output 'column display format' / wrapping

First of, I'm not sure what the correct technical name is for this. The problem is the display width for the first column (or maybe total table width) on commands like wp plugin list and it outputs ...
piet's user avatar
  • 111
0 votes
0 answers
57 views

WP-CLi Uable to Install / Update Plugins

From the command WP-Cli is unable to install or update plugins, throwing the following error: The package could not be installed. "PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir ...
mjones's user avatar
  • 153
0 votes
1 answer
68 views

wp-cli incorrectly believes a plugin is currently installed

I ran wp plugin deactivate woocommerce --uninstall and it did so successfully. I verified with #ls wp-content/plugins the woocommerce folder no longer exists. Problem: when I run wp plugin install ...
mjones's user avatar
  • 153
0 votes
0 answers
52 views

WordPress CLI isn't working while use WordPress development repository

I cloned the repo from https://github.com/WordPress/wordpress-develop.git After that followed the README file from the downloaded code and installed node dependencies and execute the below commands in ...
Ashok Dhaduk's user avatar
1 vote
0 answers
63 views

Remote Export DB w. WP-cli.phar Over SSH

I am trying to export a remote wp db using the following: source_gzip_db=git-dumps/export.sql.gz source_path_to_wordpress=/home/username/public_html source_ssh_host="123.456.789.12" ...
mjones's user avatar
  • 153
0 votes
1 answer
227 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 ...
Jesse Nickles's user avatar
0 votes
1 answer
32 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 ...
Jesse Nickles's user avatar
0 votes
0 answers
97 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-...
stefantriep's user avatar
0 votes
1 answer
120 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 ...
rassoh's user avatar
  • 576
2 votes
1 answer
147 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 ...
Dash Desai's user avatar
1 vote
2 answers
479 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,...
Will's user avatar
  • 634
1 vote
1 answer
463 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. ...
Rafael Atías's user avatar
0 votes
2 answers
587 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
0 votes
1 answer
386 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?
John Dee's user avatar
  • 503
1 vote
0 answers
106 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 --...
Max's user avatar
  • 121
1 vote
1 answer
2k 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 ...
Roberto Cinetto's user avatar
0 votes
1 answer
255 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 ...
Elv1s's user avatar
  • 3
1 vote
1 answer
418 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 ...
rok's user avatar
  • 224
1 vote
1 answer
705 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 ...
Jonas Bang's user avatar
0 votes
0 answers
429 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 ...
Jurgen Oldenburg's user avatar
0 votes
1 answer
539 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 ...
ParisNakitaKejser's user avatar
0 votes
1 answer
162 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) ...
Talk Nerdy To Me's user avatar
0 votes
1 answer
58 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 ...
O. Jones's user avatar
  • 471
1 vote
0 answers
56 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 ...
jamkaka's user avatar
  • 11
2 votes
0 answers
117 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 ...
Sam's user avatar
  • 2,106

1
2 3 4 5
8