SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
A better WordPress
workflow with WP-CLI
By Rikesh Ramlochund
WP-CLI
› WP-CLI is a set of command-line tools for managing
WordPress installations
› Install a WordPress website
› Update WordPress core, plugins, and themes
› Automate repetitive tasks
› Make your own commands
› ssh on your server and run the commands
WP-CLI Installation
› Installation and upgrade: https://wp-cli.org/
› Download the wp-cli.phar file

curl -O https://raw.githubusercontent.com/
wp-cli/builds/gh-pages/phar/wp-cli.phar
› Check if the file works

php wp-cli.phar —-info
WP-CLI Installation
› To be able to type just wp, instead of php wp-cli.phar, you
need to make the file executable and move it to
somewhere in your PATH.
› chmod +x wp-cli.phar
› sudo mv wp-cli.phar /usr/local/bin/wp
› wp —-info
WP-CLI Installation
› WP-CLI can also be installed via Composer or Homebrew
› Debian and Ubuntu users can install WP-CLI via a .deb
package
› WP-CLI can also be installed on Windows
› Read more about WP-CLI Installation: https://wp-cli.org/
docs/installing/
WP-CLI Command Anatomy
› wp plugin install jetpack
› wp: All WP-CLI commands start with wp
› plugin: command
› install: subcommand
› jetpack: options/parameters (here it is a plugin name)
Node.js Wrapper
› npm install wp-cli



Node wrapper for Wordpress CLI with functionality
matching the WP-CLI API.

Learn more: https://www.npmjs.com/package/wp-cli
Installing WordPress using WP-CLI
› Download the WordPress core:

wp core download

or

wp core download —-locale=fr_FR
Installing WordPress using WP-CLI
› Generate the wp-config.php file

wp core config --dbname=devconwp 

--dbuser=devcon --dbpass=somePassword
› Create the database file (dbname value from command
above)

wp db create
Installing WordPress using WP-CLI
› Run the WordPress installation process

wp core install —-prompt
› Installation done :)
› Note: ——prompt is a global parameter of WP-CLI, and it
prompts the user to enter values for all command
arguments
Installing WordPress using WP-CLI
› Recap:
› wp core download
› wp core config --dbname=devconwp 

--dbuser=devcon —-dbpass=somePassword
› wp db create
› wp core install —-prompt
WordPress Core commands
› Check for update via Version Check API

wp core check-update
› Update WordPress

wp core update and wp core update-db
› Verify WordPress files against wordpress.org checksums

wp core verify-checksums
› Display the WordPress version

wp core version
Plugin Management
› List all plugins

wp plugin list
› List plugins with pending updates

wp plugin list —-update=available
› Plugin Installation

wp plugin install advanced-custom-fields

wp plugin install jetpack —-version=“3.6”

wp plugin install my-plugin.zip
Plugin Management
› Install premium plugins via zip file.
› Advanced Custom Fields Pro allows you to download a zip
file using your private key
› wget -v -O acf-pro.zip “http://
connect.advancedcustomfields.com/index.php?
p=pro&a=download&k=YOUR_ACF_PRO_KEY”
› wp plugin install acf-pro.zip --activate
› rm acf-pro.zip
Plugin Management
› Some plugins like Jetpack also implement WP-CLI
commands.
› For example:

wp jetpack status

wp jetpack module list

wp jetpack module activate carousel
Plugin Management
› Activate a plugin

wp plugin activate jetpack
› Deactivate a plugin

wp plugin deactivate jetpack
› Update all plugins

wp plugin update --all
WordPress Maintenance
› Keeping WordPress up to date
› wp core update
› wp core update-db
› wp plugins update --all
› wp theme update --all
› Don’t forget to backup your files before doing updates!
WordPress Backups
› Export WordPress database via WP-CLI

wp db export
› Compress the WordPress directory

tar -vczf backup.gz .
Database Migration
› Moving a WordPress installation to another server (eg.
staging to production)
› Step 1: Export staging database

wp db export
› Step 2: Move database to production and import

wp db import
› Step 3: Update URLs from staging to production

wp search-replace “http://
staging.example.com” “http://example.com”
Managing Options
› Read option value

wp option get blogname
› Update option value

wp option update blogname “Awesome WP”
› Delete option

wp option delete optional
› List options

wp option list
Useful Commands
› Regenerate thumbnails

wp media regenerate
› Generate x posts, using some Lorem Ipsum text

curl http://loripsum.net/api/5 | wp post
generate --post_content --count=x
› Run a query saved in a file

wp db query < debug.sql
› Command helper

wp help plugin install
Useful Commands
› Import WXR file

wp import posts.xml
› Bulk importing images as attachments

Import all JPGs from the user’s Pictures directory

wp media import ~/Pictures/**/*.jpg
› Import a specific image and assign it as post thumbnail for
that post

wp media import ~/Downloads/image.png --
post_id=123 --title="A downloaded picture"
--featured_image
Useful Commands
› Delete all transients

wp transient delete-all
› Delete all expired transients

wp transient delete-expired
› List registered post types

wp post-type list
Useful Commands
› Update user password

wp user update 1 —-user_pass=newpass
› List all posts

wp post list
› List all users

wp user list
Scaffolding
› _s Theme scaffolding

wp scaffold _s devconmru --theme_name="The
Devconmru Theme" —-author=“Devconmru” 

—-sassify
› New post type

wp scaffold post-type books —-theme
› Create a child theme

wp scaffold child-theme devconmru-child --
parent_theme=devconmru —-theme_name=‘Child
Theme'
WP-CLI Internal API
› Extend WP-CLI with new command

WP_CLI::add_command()
› Execute callbacks for a specific hook

WP_CLI::do_hook()
› Displaying messages

WP_CLI::line()

WP_CLI::success() 

WP_CLI::error() //script exited after this one
Custom WP-CLI Commands
› Extend WP-CLI with your own commands
› No performance issues since the code is only loaded
when accessed through WP-CLI

if ( defined('WP_CLI') && WP_CLI ) {

require __DIR__ . '/wp-cli-command.php';

}
Custom WP-CLI Commands
› 

function post_count_callback(){

//Write code here

}



WP_CLI::add_command('post-count',
'post_count_callback');
› New command available! 

wp post-count

Demo code: https://github.com/rrikesh/wp-cli-
post-count

Thank you!
› Questions?
› If you have any questions after the presentation:

Tweet me at @rrikesh

Mail me on r@paperboat.io

Weitere ähnliche Inhalte

Was ist angesagt?

Using Capifony for Symfony apps deployment (updated)
Using Capifony for Symfony apps deployment (updated)Using Capifony for Symfony apps deployment (updated)
Using Capifony for Symfony apps deployment (updated)Žilvinas Kuusas
 
Automated Tasks for WordPress
Automated Tasks for WordPressAutomated Tasks for WordPress
Automated Tasks for WordPressJoe Cartonia
 
Ansible 101, Gennadiy Mykhailiuta
Ansible 101, Gennadiy MykhailiutaAnsible 101, Gennadiy Mykhailiuta
Ansible 101, Gennadiy MykhailiutaTetiana Saputo
 
Cf camp 2019 cfconfig - a new way to manage your cold-fusion engine config
Cf camp 2019   cfconfig - a new way to manage your cold-fusion engine configCf camp 2019   cfconfig - a new way to manage your cold-fusion engine config
Cf camp 2019 cfconfig - a new way to manage your cold-fusion engine configOrtus Solutions, Corp
 
Powershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge ClubPowershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge ClubEssam Salah
 
Sunil phani's take on windows powershell
Sunil phani's take on windows powershellSunil phani's take on windows powershell
Sunil phani's take on windows powershellSunil Phani
 
Local Dev on Virtual Machines - Vagrant, VirtualBox and Ansible
Local Dev on Virtual Machines - Vagrant, VirtualBox and AnsibleLocal Dev on Virtual Machines - Vagrant, VirtualBox and Ansible
Local Dev on Virtual Machines - Vagrant, VirtualBox and AnsibleJeff Geerling
 
Infrastructure = Code
Infrastructure = CodeInfrastructure = Code
Infrastructure = CodeGeorg Sorst
 
Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server
Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu ServerForget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server
Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Serveraaroncouch
 
Securing Your WordPress Installation
Securing Your WordPress InstallationSecuring Your WordPress Installation
Securing Your WordPress InstallationLester Chan
 
A quick intro to Ansible
A quick intro to AnsibleA quick intro to Ansible
A quick intro to AnsibleDan Vaida
 
Ansible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less CoffeeAnsible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less CoffeeSarah Z
 
Automation and Ansible
Automation and AnsibleAutomation and Ansible
Automation and Ansiblejtyr
 
Ansible + WordPress
Ansible + WordPressAnsible + WordPress
Ansible + WordPressAlan Lok
 

Was ist angesagt? (20)

Using Capifony for Symfony apps deployment (updated)
Using Capifony for Symfony apps deployment (updated)Using Capifony for Symfony apps deployment (updated)
Using Capifony for Symfony apps deployment (updated)
 
Automated Tasks for WordPress
Automated Tasks for WordPressAutomated Tasks for WordPress
Automated Tasks for WordPress
 
Ansible
AnsibleAnsible
Ansible
 
Ansible 101, Gennadiy Mykhailiuta
Ansible 101, Gennadiy MykhailiutaAnsible 101, Gennadiy Mykhailiuta
Ansible 101, Gennadiy Mykhailiuta
 
Cialug August 2021
Cialug August 2021Cialug August 2021
Cialug August 2021
 
Cf camp 2019 cfconfig - a new way to manage your cold-fusion engine config
Cf camp 2019   cfconfig - a new way to manage your cold-fusion engine configCf camp 2019   cfconfig - a new way to manage your cold-fusion engine config
Cf camp 2019 cfconfig - a new way to manage your cold-fusion engine config
 
Powershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge ClubPowershell Seminar @ ITWorx CuttingEdge Club
Powershell Seminar @ ITWorx CuttingEdge Club
 
Sunil phani's take on windows powershell
Sunil phani's take on windows powershellSunil phani's take on windows powershell
Sunil phani's take on windows powershell
 
Powershell alias
Powershell aliasPowershell alias
Powershell alias
 
Curl Tutorial
Curl Tutorial Curl Tutorial
Curl Tutorial
 
Cold fusion is racecar fast
Cold fusion is racecar fastCold fusion is racecar fast
Cold fusion is racecar fast
 
Local Dev on Virtual Machines - Vagrant, VirtualBox and Ansible
Local Dev on Virtual Machines - Vagrant, VirtualBox and AnsibleLocal Dev on Virtual Machines - Vagrant, VirtualBox and Ansible
Local Dev on Virtual Machines - Vagrant, VirtualBox and Ansible
 
Infrastructure = Code
Infrastructure = CodeInfrastructure = Code
Infrastructure = Code
 
Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server
Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu ServerForget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server
Forget MAMP and WAMP, Use Virtual Box to Have a Real Ubuntu Server
 
Securing Your WordPress Installation
Securing Your WordPress InstallationSecuring Your WordPress Installation
Securing Your WordPress Installation
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
A quick intro to Ansible
A quick intro to AnsibleA quick intro to Ansible
A quick intro to Ansible
 
Ansible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less CoffeeAnsible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less Coffee
 
Automation and Ansible
Automation and AnsibleAutomation and Ansible
Automation and Ansible
 
Ansible + WordPress
Ansible + WordPressAnsible + WordPress
Ansible + WordPress
 

Ähnlich wie A Better WordPress Workflow with WP-CLI

Administer WordPress with WP-CLI
Administer WordPress with WP-CLIAdminister WordPress with WP-CLI
Administer WordPress with WP-CLISuwash Kunwar
 
Take Command of WordPress With WP-CLI at WordCamp Long Beach
Take Command of WordPress With WP-CLI at WordCamp Long BeachTake Command of WordPress With WP-CLI at WordCamp Long Beach
Take Command of WordPress With WP-CLI at WordCamp Long BeachDiana Thompson
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLIDiana Thompson
 
Session: WP Site Management using WP-CLI from Scratch
Session: WP Site Management using WP-CLI from ScratchSession: WP Site Management using WP-CLI from Scratch
Session: WP Site Management using WP-CLI from ScratchRoald Umandal
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLIDiana Thompson
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLIDiana Thompson
 
Extending Your WordPress Toolbelt with WP-CLI
Extending Your WordPress Toolbelt with WP-CLIExtending Your WordPress Toolbelt with WP-CLI
Extending Your WordPress Toolbelt with WP-CLIryanduff
 
Developers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLIDevelopers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLIWP Engine
 
Introduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command lineIntroduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command lineBehzod Saidov
 
Advanced WordPress Tooling: By InstaWP.com
Advanced WordPress Tooling: By InstaWP.comAdvanced WordPress Tooling: By InstaWP.com
Advanced WordPress Tooling: By InstaWP.comInstaWP Inc
 
WordPress and The Command Line
WordPress and The Command LineWordPress and The Command Line
WordPress and The Command LineKelly Dwan
 
Getting Started with WP-CLI, a tool to automate your life
Getting Started with WP-CLI, a tool to automate your lifeGetting Started with WP-CLI, a tool to automate your life
Getting Started with WP-CLI, a tool to automate your lifeAJ Morris
 
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...Andrea Cardinali
 
Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)LumoSpark
 
WooCommerce WP-CLI Basics
WooCommerce WP-CLI BasicsWooCommerce WP-CLI Basics
WooCommerce WP-CLI Basicscorsonr
 
Dockerizing Windows Server Applications by Ender Barillas and Taylor Brown
Dockerizing Windows Server Applications by Ender Barillas and Taylor BrownDockerizing Windows Server Applications by Ender Barillas and Taylor Brown
Dockerizing Windows Server Applications by Ender Barillas and Taylor BrownDocker, Inc.
 
DockerCon 2016 - Dockerizing Windows Server Applications
DockerCon 2016 - Dockerizing Windows Server ApplicationsDockerCon 2016 - Dockerizing Windows Server Applications
DockerCon 2016 - Dockerizing Windows Server ApplicationsTaylor Brown
 
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cliWordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cliGetSource
 
WordPress Development Environments
WordPress Development Environments WordPress Development Environments
WordPress Development Environments Ohad Raz
 
WP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of DeveloperWP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of DeveloperChandra Patel
 

Ähnlich wie A Better WordPress Workflow with WP-CLI (20)

Administer WordPress with WP-CLI
Administer WordPress with WP-CLIAdminister WordPress with WP-CLI
Administer WordPress with WP-CLI
 
Take Command of WordPress With WP-CLI at WordCamp Long Beach
Take Command of WordPress With WP-CLI at WordCamp Long BeachTake Command of WordPress With WP-CLI at WordCamp Long Beach
Take Command of WordPress With WP-CLI at WordCamp Long Beach
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
 
Session: WP Site Management using WP-CLI from Scratch
Session: WP Site Management using WP-CLI from ScratchSession: WP Site Management using WP-CLI from Scratch
Session: WP Site Management using WP-CLI from Scratch
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
 
Extending Your WordPress Toolbelt with WP-CLI
Extending Your WordPress Toolbelt with WP-CLIExtending Your WordPress Toolbelt with WP-CLI
Extending Your WordPress Toolbelt with WP-CLI
 
Developers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLIDevelopers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLI
 
Introduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command lineIntroduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command line
 
Advanced WordPress Tooling: By InstaWP.com
Advanced WordPress Tooling: By InstaWP.comAdvanced WordPress Tooling: By InstaWP.com
Advanced WordPress Tooling: By InstaWP.com
 
WordPress and The Command Line
WordPress and The Command LineWordPress and The Command Line
WordPress and The Command Line
 
Getting Started with WP-CLI, a tool to automate your life
Getting Started with WP-CLI, a tool to automate your lifeGetting Started with WP-CLI, a tool to automate your life
Getting Started with WP-CLI, a tool to automate your life
 
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
 
Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)Web development automatisation for fun and profit (Artem Daniliants)
Web development automatisation for fun and profit (Artem Daniliants)
 
WooCommerce WP-CLI Basics
WooCommerce WP-CLI BasicsWooCommerce WP-CLI Basics
WooCommerce WP-CLI Basics
 
Dockerizing Windows Server Applications by Ender Barillas and Taylor Brown
Dockerizing Windows Server Applications by Ender Barillas and Taylor BrownDockerizing Windows Server Applications by Ender Barillas and Taylor Brown
Dockerizing Windows Server Applications by Ender Barillas and Taylor Brown
 
DockerCon 2016 - Dockerizing Windows Server Applications
DockerCon 2016 - Dockerizing Windows Server ApplicationsDockerCon 2016 - Dockerizing Windows Server Applications
DockerCon 2016 - Dockerizing Windows Server Applications
 
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cliWordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
 
WordPress Development Environments
WordPress Development Environments WordPress Development Environments
WordPress Development Environments
 
WP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of DeveloperWP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of Developer
 

Kürzlich hochgeladen

Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...SUHANI PANDEY
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Call Girls in Nagpur High Profile
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Servicesexy call girls service in goa
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...Neha Pandey
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLimonikaupta
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...singhpriety023
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.soniya singh
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...APNIC
 
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Sheetaleventcompany
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceDelhi Call girls
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Standkumarajju5765
 

Kürzlich hochgeladen (20)

Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
 
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
 

A Better WordPress Workflow with WP-CLI

  • 1. A better WordPress workflow with WP-CLI By Rikesh Ramlochund
  • 2. WP-CLI › WP-CLI is a set of command-line tools for managing WordPress installations › Install a WordPress website › Update WordPress core, plugins, and themes › Automate repetitive tasks › Make your own commands › ssh on your server and run the commands
  • 3. WP-CLI Installation › Installation and upgrade: https://wp-cli.org/ › Download the wp-cli.phar file
 curl -O https://raw.githubusercontent.com/ wp-cli/builds/gh-pages/phar/wp-cli.phar › Check if the file works
 php wp-cli.phar —-info
  • 4. WP-CLI Installation › To be able to type just wp, instead of php wp-cli.phar, you need to make the file executable and move it to somewhere in your PATH. › chmod +x wp-cli.phar › sudo mv wp-cli.phar /usr/local/bin/wp › wp —-info
  • 5. WP-CLI Installation › WP-CLI can also be installed via Composer or Homebrew › Debian and Ubuntu users can install WP-CLI via a .deb package › WP-CLI can also be installed on Windows › Read more about WP-CLI Installation: https://wp-cli.org/ docs/installing/
  • 6. WP-CLI Command Anatomy › wp plugin install jetpack › wp: All WP-CLI commands start with wp › plugin: command › install: subcommand › jetpack: options/parameters (here it is a plugin name)
  • 7. Node.js Wrapper › npm install wp-cli
 
 Node wrapper for Wordpress CLI with functionality matching the WP-CLI API.
 Learn more: https://www.npmjs.com/package/wp-cli
  • 8. Installing WordPress using WP-CLI › Download the WordPress core:
 wp core download
 or
 wp core download —-locale=fr_FR
  • 9. Installing WordPress using WP-CLI › Generate the wp-config.php file
 wp core config --dbname=devconwp 
 --dbuser=devcon --dbpass=somePassword › Create the database file (dbname value from command above)
 wp db create
  • 10. Installing WordPress using WP-CLI › Run the WordPress installation process
 wp core install —-prompt › Installation done :) › Note: ——prompt is a global parameter of WP-CLI, and it prompts the user to enter values for all command arguments
  • 11. Installing WordPress using WP-CLI › Recap: › wp core download › wp core config --dbname=devconwp 
 --dbuser=devcon —-dbpass=somePassword › wp db create › wp core install —-prompt
  • 12. WordPress Core commands › Check for update via Version Check API
 wp core check-update › Update WordPress
 wp core update and wp core update-db › Verify WordPress files against wordpress.org checksums
 wp core verify-checksums › Display the WordPress version
 wp core version
  • 13. Plugin Management › List all plugins
 wp plugin list › List plugins with pending updates
 wp plugin list —-update=available › Plugin Installation
 wp plugin install advanced-custom-fields
 wp plugin install jetpack —-version=“3.6”
 wp plugin install my-plugin.zip
  • 14. Plugin Management › Install premium plugins via zip file. › Advanced Custom Fields Pro allows you to download a zip file using your private key › wget -v -O acf-pro.zip “http:// connect.advancedcustomfields.com/index.php? p=pro&a=download&k=YOUR_ACF_PRO_KEY” › wp plugin install acf-pro.zip --activate › rm acf-pro.zip
  • 15. Plugin Management › Some plugins like Jetpack also implement WP-CLI commands. › For example:
 wp jetpack status
 wp jetpack module list
 wp jetpack module activate carousel
  • 16. Plugin Management › Activate a plugin
 wp plugin activate jetpack › Deactivate a plugin
 wp plugin deactivate jetpack › Update all plugins
 wp plugin update --all
  • 17. WordPress Maintenance › Keeping WordPress up to date › wp core update › wp core update-db › wp plugins update --all › wp theme update --all › Don’t forget to backup your files before doing updates!
  • 18. WordPress Backups › Export WordPress database via WP-CLI
 wp db export › Compress the WordPress directory
 tar -vczf backup.gz .
  • 19. Database Migration › Moving a WordPress installation to another server (eg. staging to production) › Step 1: Export staging database
 wp db export › Step 2: Move database to production and import
 wp db import › Step 3: Update URLs from staging to production
 wp search-replace “http:// staging.example.com” “http://example.com”
  • 20. Managing Options › Read option value
 wp option get blogname › Update option value
 wp option update blogname “Awesome WP” › Delete option
 wp option delete optional › List options
 wp option list
  • 21. Useful Commands › Regenerate thumbnails
 wp media regenerate › Generate x posts, using some Lorem Ipsum text
 curl http://loripsum.net/api/5 | wp post generate --post_content --count=x › Run a query saved in a file
 wp db query < debug.sql › Command helper
 wp help plugin install
  • 22. Useful Commands › Import WXR file
 wp import posts.xml › Bulk importing images as attachments
 Import all JPGs from the user’s Pictures directory
 wp media import ~/Pictures/**/*.jpg › Import a specific image and assign it as post thumbnail for that post
 wp media import ~/Downloads/image.png -- post_id=123 --title="A downloaded picture" --featured_image
  • 23. Useful Commands › Delete all transients
 wp transient delete-all › Delete all expired transients
 wp transient delete-expired › List registered post types
 wp post-type list
  • 24. Useful Commands › Update user password
 wp user update 1 —-user_pass=newpass › List all posts
 wp post list › List all users
 wp user list
  • 25. Scaffolding › _s Theme scaffolding
 wp scaffold _s devconmru --theme_name="The Devconmru Theme" —-author=“Devconmru” 
 —-sassify › New post type
 wp scaffold post-type books —-theme › Create a child theme
 wp scaffold child-theme devconmru-child -- parent_theme=devconmru —-theme_name=‘Child Theme'
  • 26. WP-CLI Internal API › Extend WP-CLI with new command
 WP_CLI::add_command() › Execute callbacks for a specific hook
 WP_CLI::do_hook() › Displaying messages
 WP_CLI::line()
 WP_CLI::success() 
 WP_CLI::error() //script exited after this one
  • 27. Custom WP-CLI Commands › Extend WP-CLI with your own commands › No performance issues since the code is only loaded when accessed through WP-CLI
 if ( defined('WP_CLI') && WP_CLI ) {
 require __DIR__ . '/wp-cli-command.php';
 }
  • 28. Custom WP-CLI Commands › 
 function post_count_callback(){
 //Write code here
 }
 
 WP_CLI::add_command('post-count', 'post_count_callback'); › New command available! 
 wp post-count
 Demo code: https://github.com/rrikesh/wp-cli- post-count

  • 29. Thank you! › Questions? › If you have any questions after the presentation:
 Tweet me at @rrikesh
 Mail me on r@paperboat.io