Created
March 7, 2024 12:23
-
-
Save esedic/9da83247453ae416d9091aa1013a7a2f to your computer and use it in GitHub Desktop.
Install WP-CLI and check if WP-CRON works
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Download wp-cli.phar using wget or curl: | |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | |
2. Check if it works: | |
php wp-cli.phar --info | |
3. 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. For example: | |
chmod +x wp-cli.phar | |
sudo mv wp-cli.phar /usr/local/bin/wp | |
Now try running wp --info. | |
4. Check if WP Cron works: | |
wp cron test | |
If you get "Error: WP-Cron spawn returned HTTP status code: 401 Unauthorized" | |
Put this in .htaccess: | |
# Exclude the WP CRON and other scripts from authentication | |
<FilesMatch "(wp-cron.php|another-script.php)$"> | |
Satisfy Any | |
Order allow,deny | |
Allow from all | |
Deny from none | |
</FilesMatch> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment