Coder Social home page Coder Social logo

msn60 / wpcli Goto Github PK

View Code? Open in Web Editor NEW

This project forked from insaurabh/wpcli

0.0 0.0 0.0 32 KB

Useful wp cli commands for every WordPress Developer. This repo will contain all the useful commands that help WordPress developer to speed up the development process.

PHP 75.26% CSS 24.74%

wpcli's Introduction

wpcli

Useful wp cli commands for every WordPress Developer. This repo will contain all the useful commands that help WordPress developer to speed up the development process.For complete list please refer official wp-cli documentation.

How to install wpcli:question:

# With Phar file
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
#and
php wp-cli.phar --info
#and
chmod +x wp-cli.phar
#and
sudo mv wp-cli.phar /usr/local/bin/wp

1. How to check wordpress version:question:

๐Ÿ’ฒ wp core version

4.9.7

2. Check wordpress installation bacis info:question:

๐Ÿ’ฒ wp --info

 /var/www/html/wordpress ๎‚ฐ wp --info
OS:	Linux 4.13.0-45-generic #50~16.04.1-Ubuntu SMP Wed May 30 11:18:27 UTC 2018 x86_64
Shell:	/usr/bin/zsh
PHP binary:	/usr/bin/php7.0
PHP version:	7.0.30-0ubuntu0.16.04.1
php.ini used:	/etc/php/7.0/cli/php.ini
WP-CLI root dir:	phar://wp-cli.phar
WP-CLI vendor dir:	phar://wp-cli.phar/vendor
WP_CLI phar path:	/var/www/html/wordpress
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version:	1.5.1

3. Get list of all plugins with status:question:

๐Ÿ’ฒ wp plugin list

 /var/www/html/wordpress ๎‚ฐ wp plugin list
+---------+----------+-----------+---------+
| name    | status   | update    | version |
+---------+----------+-----------+---------+
| akismet | inactive | available | 4.0.3   |
| hello   | inactive | none      | 1.7     |
+---------+----------+-----------+---------+

4. Activate a plugin:question:

๐Ÿ’ฒ wp plugin activate plugin_name ( see the name from plugin list as shown in above command)

 /var/www/html/wordpress ๎‚ฐ wp plugin activate hello
Plugin 'hello' activated.
Success: Activated 1 of 1 plugins.

5. Check status of a plugin:question:

 /var/www/html/wordpress ๎‚ฐ wp plugin status hello
Plugin hello details:
    Name: Hello Dolly
    Status: Active
    Version: 1.7
    Author: Matt Mullenweg
    Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> in the upper right of your admin screen on every page.

6. Install a plugin and activate it:question:

๐Ÿ’ฒ wp plugin install woocommerce --activate

 /var/www/html/wordpress ๎‚ฐ wp plugin install woocommerce --activate
Installing WooCommerce (3.4.3)
Downloading installation package from https://downloads.wordpress.org/plugin/woocommerce.3.4.3.zip...
Unpacking the package...
Installing the plugin...
Plugin installed successfully.
Activating 'woocommerce'...
Plugin 'woocommerce' activated.
Success: Installed 1 of 1 plugins.

7. Create a new user:question:

๐Ÿ’ฒ wp user create username useremail --role=rolename

 /var/www/html/wordoress ๎‚ฐ wp user create inrsaurabh [email protected]  --role=author
Success: Created user 2.
Password: a$hgLg3HeZJsy%sOnsZG!qes

8. Update an user password:question:

๐Ÿ’ฒ wp user update user_id --user_pass=new_password

 /var/www/html/wordoress ๎‚ฐ wp user update 2 --user_pass=your_new_password
Success: Updated user 2.

9. Get all theme list:question:

๐Ÿ’ฒ wp theme list

 /var/www/html/wordpress ๎‚ฐ wp theme list
+-----------------+----------+--------+---------+
| name            | status   | update | version |
+-----------------+----------+--------+---------+
| twentyfifteen   | inactive | none   | 2.0     |
| twentyseventeen | active   | none   | 1.6     |
| twentysixteen   | inactive | none   | 1.5     |
+-----------------+----------+--------+---------+

10. Activate a theme:question:

๐Ÿ’ฒ wp theme activate themename ( see name from above list)

 /var/www/html/wordpress ๎‚ฐ wp theme activate twentysixteen
Success: Switched to 'Twenty Sixteen' theme.

11. Create child theme:question:

๐Ÿ’ฒ wp scaffold child-theme child-theme-name --parent_theme=parentthemename ( see name from above list)

 /var/www/html/wordpress ๎‚ฐ wp scaffold child-theme twentysixteen-child --parent_theme=twentyseventeen
Success: Created '/var/www/html/wordpress/wp-content/themes/twentysixteen-child'.

12. Delete a theme:question:

๐Ÿ’ฒ wp theme delete themename ( see name from above list)

 /var/www/html/wordpress ๎‚ฐ wp theme delete **themename**
Deleted '**themename**' theme.
Success: Deleted 1 of 1 themes.

13. Flushes rewrite rules ( permalink updates ):question:

๐Ÿ’ฒ wp rewrite flush

 /var/www/html/wordpress ๎‚ฐ wp rewrite flush
Success: Rewrite rules flushed.

14. Get database name with list of tables:question:

๐Ÿ’ฒ wp db check

 /var/www/html/wordpress ๎‚ฐ wp db check
db_name.prefix_tableName                           OK
wppwa.wppwa_comments                               OK
...................................
..................................
Success: Database checked.

15. Update siteurl and home url ( search and replace any string):question:

๐Ÿ’ฒ wp search-replace 'http://localhost/projectname' 'http://projectname.com' --skip-columns=guid

 /var/www/html/wordpress ๎‚ฐ wp search-replace 'http://localhost/projectname' 'http://projectname.com' --skip-columns=guid
+---------------------+-----------------------+--------------+------+
| Table               | Column                | Replacements | Type |
+---------------------+-----------------------+--------------+------+
| wppwa_commentmeta   | meta_key              | 0            | SQL  |
| wppwa_commentmeta   | meta_value            | 0            | SQL  |
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 wppwa_options        | option_value           | 2            | PHP |
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
| wppwa_users         | user_activation_key   | 0            | SQL  |
| wppwa_users         | display_name          | 0            | SQL  |
+---------------------+-----------------------+--------------+------+


Success: Made 8 replacements.

16. How to install Wordpress:question:

 - mkdir blog
 - cd blog
 - wp core download
 - wp core config --dbhost=your_host_name --dbname=db_prefix --dbuser=username --dbpass=password
 - wp core install --url=yourwebsite.com --title="Your Blog Title" --admin_name=wordpress_admin_name --admin_password=admin_pwd [email protected]
 - chmod 644 wp-config.php
 - chmod 775 uploads/

To use next 3 commands include these commands in your theme.

17. How to UPDATE an option:question:

 - wp option update start_of_weeks 0

18. How to DELETE an option:question:

 - wp option delete start_of_weeks

19. How to ADD an option:question:

 - wp option add option_name option_value

19. How to get the plugin list which have update available by wp cli:question:

 -  wp plugin list --update=available

19. How to delete a post type โ“

 -  wp post delete $(wp post list --post_type='property' --format=ids) --force

Download, Fork, Commit.

Please Download, Fork, & Commit to add more helpful commands.

wpcli's People

Contributors

insaurabh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.