If you aren’t already using WP-CLI, start using it now. WP-CLI makes your day-to-day WordPress workflows easier. Some of my favorite WP-CLI commands are:
1) wp install plugin plugin-slug – automatically install the plugin on your site. For example, if you want to install the WPForce Logout plugin, then simply run wp install plugin wp-force-logout. You don’t have to download or search for the plugin to install.
2) wp activate plugin plugin-slug – automatically activate the plugin.
3) wp eval – enter the PHP code from within the command line. Examples:
wp eval 'echo rand();' --skip-wordpressgenerates a random number. --skip-wordpress to execute code without loading WordPress.
wp eval 'echo get_option("last_login");'generates the value of last_login stored in the options table.
4) wp i18n make-pot – creates a pot file for the plugin. Go to the plugin’s directory and enter the command wp i18n make-pot . languages/plugin-slug.pot
Similar comands: wp i18n make-json, wp i18n make-mo
5) wp user – manages user data.
wp user create ram ram@example.com --role=administrator – creates a user.wp user delete ram – deletes a user ram. You can pass user login, user email, or user ID.wp user list – list all users.
6) wp scaffold – creates a scaffold plugin or theme. Along with the tests. How cool.
wp scaffold plugin sample-plugin – creates a Sample Plugin in the wp-content/plugins directory. Start building an awesome plugin.
7) wp config edit – instantly edit the wp-config.php. The file will automatically open for you to edit.
8) wp option – manages options in wp_options DB table.
wp option delete wpfda_review_notice_dismissed – deletes the option “wpfda_review_notice_dismissed” which helps to re-display the review notice for WP Frontend Delete Account plugin.
9) wp post – manages the WordPress posts.wp post create --post-title=All In One Music Player Test --post-content=[all_in_one_music_player]wp delete post 22 --force – deletes the post ID 22, force deletes the post by skipping trash.
…updating soon