--- description: Learn how to use the Action Scheduler background processing job queue for WordPress in your WordPress plugin. --- # Usage Using Action Scheduler requires: 1. installing the library 1. scheduling an action ## Installation There are two ways to install Action Scheduler: 1. regular WordPress plugin; or 1. a library within your plugin's codebase. Note that [Action Scheduler follows an L-2 dependency version policy](https://developer.woocommerce.com/2023/10/24/action-scheduler-to-adopt-l-2-dependency-version-policy/). That is, the library requires at least the "latest minus two" version of WordPress and the PHP minimum version requirement of that WordPress version. ### Usage as a Plugin Action Scheduler includes the necessary file headers to be used as a standard WordPress plugin. To install it as a plugin: 1. Download the .zip archive of the latest [stable release](https://github.com/woocommerce/action-scheduler/releases) 1. Go to the **Plugins > Add New > Upload** administration screen on your WordPress site 1. Select the archive file you just downloaded 1. Click **Install Now** 1. Click **Activate** Or clone the Git repository into your site's `wp-content/plugins` folder. Using Action Scheduler as a plugin can be handy for developing against newer versions, rather than having to update the subtree in your codebase. **When installed as a plugin, Action Scheduler does not provide any user interfaces for scheduling actions**. The only way to interact with Action Scheduler is via code. ### Usage as a Library To use Action Scheduler as a library: 1. include the Action Scheduler codebase 1. load the library by including the `action-scheduler.php` file Using a [subtree in your plugin, theme or site's Git repository](https://www.atlassian.com/blog/git/alternatives-to-git-submodule-git-subtree) to include Action Scheduler is the recommended method. Composer can also be used. To include Action Scheduler as a git subtree: #### Step 1. Add the Repository as a Remote ``` git remote add -f subtree-action-scheduler https://github.com/woocommerce/action-scheduler.git ``` Adding the subtree as a remote allows us to refer to it in short from via the name `subtree-action-scheduler`, instead of the full GitHub URL. #### Step 2. Add the Repo as a Subtree ``` git subtree add --prefix libraries/action-scheduler subtree-action-scheduler trunk --squash ``` This will add the `trunk` branch of Action Scheduler to your repository in the folder `libraries/action-scheduler`. You can change the `--prefix` to change where the code is included. Or change the `trunk` branch to a tag, like `2.1.0` to include only a stable version. #### Step 3. Update the Subtree To update Action Scheduler to a new version, use the commands: ``` git fetch subtree-action-scheduler trunk git subtree pull --prefix libraries/action-scheduler subtree-action-scheduler trunk --squash ``` ### Loading Action Scheduler Regardless of how it is installed, to load Action Scheduler, you only need to include the `action-scheduler.php` file, e.g. ```php