# Using WP-CLI in your WordPress application

> Learn how to use WP-CLI commands to manage your WordPress site directly from the application interface

# Using WP-CLI in your WordPress application

WP-CLI (WordPress Command Line Interface) is automatically included in all WordPress applications deployed on our platform. This powerful tool lets you manage your WordPress site, update plugins, configure settings, and perform maintenance tasks without using the WordPress admin interface.

## What is WP-CLI?

WP-CLI is the official command-line tool for WordPress. It provides a faster, more efficient way to manage WordPress sites by running commands instead of clicking through the admin interface. Common tasks like updating plugins, managing users, or clearing caches can be done in seconds.

## Accessing WP-CLI

You can run WP-CLI commands directly from your application's Commands tab:

1. Navigate to your WordPress application
2. Click on the "Commands" tab
3. Select an instance from the dropdown (if you have multiple instances running)
4. Enter your WP-CLI command in the command field
5. Click "Run command" to execute it

The command output will appear below, showing you the results of your command.

## Getting started with WP-CLI

To use WP-CLI, simply enter any valid WP-CLI command in the command field. All commands start with `wp` followed by the specific action you want to perform.

For a complete list of available commands and their usage, you can run `wp help` or visit the official WP-CLI documentation.

## Important notes

- All WP-CLI commands run with appropriate permissions, so you don't need to worry about file ownership issues
- Commands are executed in the WordPress root directory automatically
- Database connection details are automatically configured from your environment
- Changes made through WP-CLI take effect immediately on your live site

## Troubleshooting common issues

### Command not found

If you see "command not found" errors, make sure to prefix your commands with `wp`. For example, use `wp plugin list` not just `plugin list`.

### Permission errors

WP-CLI runs with the correct permissions automatically. If you encounter permission issues, it's likely due to file system restrictions rather than WP-CLI itself.

### Database connection errors

Database credentials are automatically configured. If you see connection errors, check that your database service is running in the Services tab.

## Best practices

1. **Test commands first**: For critical operations, test on a staging environment first
2. **Make backups**: Before major changes, export your database using `wp db export`
3. **Use specific versions**: When installing plugins/themes, specify versions for consistency
4. **Check before updating**: Run `wp plugin status` before bulk updates to see what will change
5. **Monitor output**: Always review command output for warnings or errors

WP-CLI makes WordPress management faster and more efficient. Whether you're updating plugins, managing users, or performing maintenance, you can accomplish tasks quickly without navigating through the WordPress admin interface.
