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
1
vote
1 answer

Change `wp db export` default database name

Is there a way to change what the database is named when using the wp db export command? When I type wp db export on one of my WordPress sites, the database gets named {dbname}-{Y-m-d}-{random-hash}.sql, which is correct according to WP-CLI…
Adam Gonzales
  • 829
  • 7
  • 11
1
vote
1 answer

wp-cli install plugin in site language

I want to improve my new Wordpress sites setup, and am working on a script to install Wordpress and common plugins. My problem is, when I install a plugin from admin panel, by default, it installs a version of my plugin in the same language as…
K. Weber
  • 2,643
  • 5
  • 45
  • 77
1
vote
0 answers

Custom WP CLI command to add data to WP REST API custom field

I'm using the WP CLI and WP REST API. To create a post I use: $ wp post create --post_type=page --post_title='title-of-page' --post_status=publish I need a field in the REST API which I added via the functions.php file in my wordpress…
1
vote
4 answers

How to fix mysql_connect() error in wp cli

Problem: I am trying to use wp cli to do stuff. As an example update wordpress: wp core update Fatal error: Uncaught Error: Call to undefined function mysql_connect() in path\to\wp-includes\wp-db.php:1564 Stack trace: #0…
NYoung
  • 157
  • 1
  • 14
1
vote
1 answer

WP-CLI - difficulty updating 'post_modified' field

WordPress' command line tool WP-CLI has a post update command for editing individual fields of a specified post. Two of the standard fields are post_modified and post_modified_gmt, (DATETIME fields in MySQL). Despite setting them to an earlier…
William Turrell
  • 3,227
  • 7
  • 39
  • 57
1
vote
0 answers

Why is media regeneration in WordPress so slow?

I am regenerating images in my WordPress using wp-cli but it is very slow. Each image takes several (about 10-20) seconds to regenerate. I am regenerating just one size (180x125) and most of the original images are normal size - few hundred kb. Am…
Juraj.Lorinc
  • 503
  • 6
  • 26
1
vote
0 answers

How to toggle auto-add-pages in wp-cli for wordpress

I've got a menu in Wordpress and I want to toggle the checkbox "auto-add-pages" via wp-cli. Tried sth. like wp option update auto-add-pages 1 but that doesn't work. I guess because it doesn't know for which menu it should be. Anybody out there to…
andi-d
  • 11
  • 2
1
vote
1 answer

Using WPI_CLI in WordPress theme's functions.php

I am trying to execute a command from within my theme's functions.php using the method described here: https://make.wordpress.org/cli/handbook/internal-api/wp-cli-runcommand/ And I am getting the following error: "Class 'WP_CLI' not found" I've…
Michelle
  • 113
  • 4
  • 13
1
vote
2 answers

WordPress Multisite: Activate / Deactivate a Plugin of a Specific Blog

Programmatically, I want to activate / deactivate a plugin of this specific blog/site in a WordPress Multisite. Any help will be gladly appreciated, thank you!
Yves
  • 807
  • 15
  • 17
1
vote
1 answer

wp-cli commands display content of plugin files in terminal

No matter what wp cli command I run. I always see the content of two plugin.php files in the terminal before the actual command results
marcelgro
  • 121
  • 3
1
vote
1 answer

WP CLI Not Displaying All Tables

I am trying to do some simple queries to figure out how a plugin is saving its information. Basically I was getting a really annoying error, and figured out the custom template content was missing on my local. Every other setting/content was…
COGara
  • 43
  • 5
1
vote
0 answers

wp-cli eval over ssh - "Too many positional arguments"

Using WP-CLI's eval over SSH and getting an error on the simplest of commands: wp eval "echo WP_CONTENT_DIR;" --ssh=forge@mysite.com Error: Too many positional arguments: WP_CONTENT_DIR I can SSH in and run commands myself just fine. Anyone have an…
Ethan C
  • 1,408
  • 1
  • 14
  • 26
1
vote
0 answers

Html structure chages when importing content from dev site using wp-cli and wordpress-importer

I am writing an auto deployment script that deploy themes and user selected plugins on a selected hosting package. the problem i am facing is that when export a WXR file from my dev site it get imported from the wp admin using wordpress importer…
kashif
  • 41
  • 3
1
vote
1 answer

backup wordpress database using wp-cli

This is a basic question.. I am trying to write a very simple script to backup my wordpress database every hour.. #!/bin/sh # # This script do an hourly backup of WordPress DB # Set global…
Frederic
  • 23
  • 6
1
vote
1 answer

Windows WP-CLI packages directory missing

Installed wp-cli on Windows via composer as global require with command composer global require wp-cli/wp-cli and get OK output like so. D:\>composer global require wp-cli/wp-cli Changed current directory to…
lowtechsun
  • 1,915
  • 5
  • 27
  • 55