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
3
votes
1 answer

How to automate wp instance setup + theme/plugin customization with docker?

I want to create a docker image for wordpress, which creates a ready to use wp instance with already setup and completed installation, activated theme and plugins and other configurations. I was exploring WP CLI to do that as part of the Dockerfile…
user358448
  • 1,127
  • 3
  • 20
  • 39
3
votes
1 answer

Bulk import products into Woocommerce using WP WC CLI

I'm trying to add 1000's of products into my woocommerce store using wp wc cli via my datasource which will give me the data in the following JSON format: { "name": "Product Name 1", "desc": "Desc 1", "category": "Main…
Gaurav Kanted
  • 115
  • 1
  • 1
  • 10
3
votes
2 answers

combine two select statements (append columns)

I have 2 Wordpress database queries, the first shows all posts + categories. The second shows all posts + custom fields. What I'm looking for is listing all posts + categories + custom fields Query 1: list posts + categories SELECT…
dean2020
  • 645
  • 2
  • 8
  • 25
3
votes
3 answers

How to iterate a JSON array in bash from jq

Background I want to be able to pass a json file to WP CLI, to iteratively create posts. So I thought I could create a JSON file: [ { "post_type": "post", "post_title": "Test", "post_content":…
bozdoz
  • 12,550
  • 7
  • 67
  • 96
3
votes
2 answers

WP CLI avoid 'Undefined index: HTTP_HOST' when using http_host in wp-config.php

I am confronted to the error PHP Notice: Undefined index: HTTP_HOST when trying to use wp-cli on my wordpress install because I have this line in my wp-config.php: define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/'); Bug is reported here…
Sulli
  • 763
  • 1
  • 11
  • 33
3
votes
0 answers

How to share volumes between wordpress and wp-cli in docker-compose

In trying to setup a reusable, semi-automated docker-compose.yml file for WordPress theme development, I found a very helpful post on StackOverflow and implemented the docker-compose.yml that vstm provided. The example works very well, and I had…
Mike Wish
  • 41
  • 7
3
votes
2 answers

How can a WordPress plugin in a docker image be activated in the build process?

I'm looking for how to activate a WordPress plugin via a Dockerfile RUN command in the build process. The relevant command in the Dockerfile is # activate plugins RUN wp plugin activate wp-discourse-export --allow-root --path=/var/www/html The…
Keith John Hutchison
  • 4,955
  • 11
  • 46
  • 64
3
votes
2 answers

Run WP-CLI using PHP

I've installed WP-CLI on the Mac and my next step is to execute WP-CLI commands using PHP script. I've tried to implement it the following way but I do not see anything happening. Can someone please look at my code and tell me that what I'm doing…
WKL
  • 37
  • 1
  • 4
3
votes
2 answers

Bulk create WooCommerce products programmatically

It is possible to bulk create products on WooCommerce? I am using the wp-cli Product command but it seems that I have to create one by one. 'My product 1'), array('title' => 'My product 2'), //…
Carlos Goce
  • 1,625
  • 4
  • 22
  • 33
3
votes
1 answer

Using WP-CLI on Windows to Manage Remote WordPress Installation?

I'm trying to manage my remote shared hosting WordPress installation via WP-CLI installed on my local Windows machine. So far I have managed to install WP-CLI (The "WP" command is available to run). But when I try and connect to a remote URL with…
Bhagwad Jal Park
  • 1,093
  • 1
  • 13
  • 22
2
votes
1 answer

Bitbucket Pipeline: run step as non-root

One of my steps in my Bitbucket deployment pipeline involves executing - step: name: Start MaintenanceMode script: - php bin/wp-cli.phar mm_enter --ssh=[...] However, understandably wp_cli.phar doesn't love being run as root. I can…
gfaster
  • 157
  • 2
  • 12
2
votes
1 answer

Custom oembed provider not getting added to Wordpress

What I want to achieve I want to add a custom oembed provider to my wordpress site. The custom oembed provider is my own web app. What I have implemented I have added the following code to the functions.php file of my theme, following the official…
2
votes
0 answers

WPCLI command not working correctly when run as CronJob

I am trying to run the cronJob as for wpcli. But the output is not as expected. For example : when I run the command wp --info on terminal I get the following output. $ ./wp-cli.phar --info OS: Linux #1 SMP Tue Jul 23 08:31:06 EDT 2019…
Wrlkq
  • 36
  • 1
2
votes
0 answers

Running wp-cli from bash script results in path error

I have successfully installed wp-cli on my remote server and created the "wp" alias. I use Putty to connect via SSH, and everything works just fine. First, I used a .user_bashrc file to set the alias with: alias…
user2516117
  • 129
  • 2
  • 4
  • 13
2
votes
1 answer

Execute a plugin-installed WP-CLI command with Docker Compose

Intro: I am trying to run a few WP-CLI commands for maintenance as a part of my release process on my production sites. I can execute the following commands against the docker-compose file below successfully. docker-compose run…
Collin Barrett
  • 2,441
  • 5
  • 32
  • 53
1
2
3
13 14