WordPress is popular content management system. By using WordPress we can make blogs and custom websites. Millions of websites run on WordPress which includes popular blogs, eCommerce stores, travelling websites, and more.
For developers wordpress provides command line interface which helps developers to create plugins, activate/deactivate plugins and themes and more common works.
For using WordPress in the command line we use ‘wp’ keyword for performing various WordPress actions. When we first time use command of ‘wp’ it may give us error that ‘wp’ is not recognized. So today I will explain how to solve this issue.
First you need to download wp-cli.phar and after downloading go to your computer C: drive and create new folder named ‘wp-cli’ and paste wp-cli.phar in it. Next create ‘wp.bat’ file in C:\wp-cli folder and paste the below code in the ‘wp.bat’ file.
@ECHO OFF php "c:/wp-cli/wp-cli.phar" %*
Now you have to set C:\wp-cli in your environment variables of windows. To set environment variable in windows 10, follow below steps:-
First go to your desktop and then right click on ‘This pc’ folder and then click on ‘properties’ from the menu. Now a window will open up. Now click on ‘Advanced styem settings’. Now click on ‘Environment Variable’ button. On ‘System variables’ tab double click on ‘Path’. Now click on ‘New’ button and paste C:\wp-cli in text box and click on ok.
Now open your command line window and ‘wp’ will work fine.