Skip to content

Instantly share code, notes, and snippets.

@esedic
Created March 7, 2024 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esedic/9da83247453ae416d9091aa1013a7a2f to your computer and use it in GitHub Desktop.
Save esedic/9da83247453ae416d9091aa1013a7a2f to your computer and use it in GitHub Desktop.
Install WP-CLI and check if WP-CRON works
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