Questions tagged [wp-cli]

wp-cli is a command line interface for WordPress.

wp-cli is a command line interface for WordPress.

You can easily install and update WordPress core, plugins, themes, and more. There's an active development community and additional commands are added regularly.

wp-cli is similar to drush, a tool for Drupal.

Document Source: http://codex.wordpress.org/wp-cli

197 questions
0
votes
0 answers

How to bulk delete unattached images in WordPress using WP CLI and exclude specific authors?

Task is to delete all images within a month's archive that are not assigned to a post and have not been uploaded by the admin (user_id 1). The number of affected images is large (>50.000 images), so they have to be deleted image by image. Command:…
David W.
  • 1
  • 2
0
votes
0 answers

WP cli php script gives notice error: A non well formed numeric value

My script gives this error: PHP Notice: A non well formed numeric value encountered. The offending line is: // Calculate price with markup and round it. $rounded_price = ( ceil ( ( $price * $multiplier ) / $nearest ) * $nearest ) - $minus; Can you…
prokops
  • 45
  • 6
0
votes
1 answer

How Do I Bulk Delete All Wordpress Posts in a Specific Category or Before a Specific Date?

I have some categories on a site with over 350,000 active posts some of which have as many as 50,000 posts. The volume makes using a bulk delete plugins not viable because they all timeout and delete nothing. The best feedback I've gotten from the…
0
votes
0 answers

Why is my xampp shell not finding mysql as a valid command?

I'm trying to use wpcli on xampp on windows, and following this tutorial -> https://lmilosis.wordpress.com/2020/01/26/19/ My issue arises entering this command wp core config --dbname=wpcli_testing --dbuser=root --dbpass= --dbhost=localhost…
lforsey
  • 33
  • 7
0
votes
0 answers

How can i set a cronjob with WP CLI for the WebP Express Plugins to convert the images

In WP CLI I can run wp webp-express convert and it works But how can get this to work in a cronjob? This was one of the things I tried: wp cron event schedule webp_express --webp-express --convert now hourly but with this the webp express plugin do…
DEV
  • 3
  • 2
0
votes
0 answers

WP Cli does not print on terminal when executing code from file

I have installed WP Cli successfully on my mac. I want to run PHP code from a file by wp shell command which is available in WP Cli Work: when interactive mode like First, run wp shell then get_bloginfo( 'version' ) it's printing what…
Harun
  • 13
  • 4
0
votes
0 answers

Error accessing database via docker wpcli container

I am trying to create a basic wordpress/mariadb/wpcli docker container stack. All works as expected, except that the wpcli service fails at startup time with this error turning up in the logs: "Error: Error establishing a database connection." To…
0
votes
2 answers

How to delete a line in a csv file after processing it with a Linux bash script

I use a Linux bash script to create posts on my WordPress website with wp-cli. this is the example of the script that I use: #! /bin/bash while IFS="|" read -r rec_column1 rec_column2 rec_column3 rec_column4 do cd /posts/ && wp post create \ …
Druz
  • 85
  • 1
  • 11
0
votes
1 answer

How to run WP-CLI command in the background from PHP?

I have a long running script in WordPress that creates a report and writes it to an Excel-file, before sending it by email to the user. This project is now complicated enough that I run into timeout issues. I have therefore moved the script into…
TASan
  • 115
  • 10
0
votes
1 answer

WP-CLI export returns a bunch of authors not needed for the exported items

When using this command in WP-CLI I get both the five wanted order items as well as some 100+ unwanted authors: wp export --dir=exports/ --start_date=2021-09-06 --post_type=shop_order --author=1 --skip_comments Why are these authors added to begin…
Karlis Rode
  • 3,643
  • 2
  • 16
  • 16
0
votes
1 answer

creating a path to wordpress in SSH Tunnel

I made a rookie mistake that I'm trying to correct. I need to access a wordpress installation and edit the database, but the host doesn't provide a control panel or phpMyadmin so I set up an ssh tunnel. I installed wp cli and verified the…
MARWEL58
  • 19
  • 1
  • 5
0
votes
0 answers

wp wc product_cat get - Remove leading whitespace?

I am using the WP-CLI for updating WooCommerce product_cat terms. When using wp wc product_cat get to retrieve individual fields, a line feed character (a0) seems to get inserted as leading character. Example: $ echo "»"$(wp wc product_cat --user=4…
Jeroen Strompf
  • 103
  • 1
  • 9
0
votes
1 answer

WP-CLI doesn't regenerate media

I am trying regenerate the all media via WP-CLI the command below: wp media regenerate --yes Unfortunately, it's return me the error: No support for generating images found. Please install the Imagick or GD PHP extensions Then I install the…
Dmitry Leiko
  • 3,970
  • 3
  • 25
  • 42
0
votes
0 answers

/usr/bin/env: ‘php’: No such file or directory and zsh: command not found: php

I have installed php 7.3.27 version I want to work with zsh but when I type "php -v", it is showing me following error: zsh: command not found: php And when I installed wp-cli, on typing "wp --info", it is showing me following error: /usr/bin/env:…
Solanki Ketul
  • 31
  • 1
  • 7
0
votes
1 answer

wp-cli table output to a variable -> wlack webhook

I am trying to send the output of a wp-cli command to a slack webhook. WP-cli outputs tables with, in this case, plugin updates. The command for this is: $ wp plugin update --all --dry-run --format=table The normal output…