{"id":21611523,"url":"https://github.com/underpin-wp/batch-task-loader","last_synced_at":"2026-05-17T21:02:08.631Z","repository":{"id":57075275,"uuid":"363980063","full_name":"Underpin-WP/batch-task-loader","owner":"Underpin-WP","description":"Adds support for Batch tasks to WordPress","archived":false,"fork":false,"pushed_at":"2021-11-23T16:27:28.000Z","size":30,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-08T01:01:52.423Z","etag":null,"topics":["background-task","batch-task","hacktoberfest","loader","underpin","wordpress"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Underpin-WP.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-03T15:44:16.000Z","updated_at":"2022-03-31T21:17:48.000Z","dependencies_parsed_at":"2022-08-24T14:55:42.022Z","dependency_job_id":null,"html_url":"https://github.com/Underpin-WP/batch-task-loader","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Underpin-WP%2Fbatch-task-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Underpin-WP%2Fbatch-task-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Underpin-WP%2Fbatch-task-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Underpin-WP%2Fbatch-task-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Underpin-WP","download_url":"https://codeload.github.com/Underpin-WP/batch-task-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244257304,"owners_count":20424131,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["background-task","batch-task","hacktoberfest","loader","underpin","wordpress"],"created_at":"2024-11-24T21:13:00.400Z","updated_at":"2026-05-17T21:02:08.538Z","avatar_url":"https://github.com/Underpin-WP.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Underpin batch task Loader\n\nLoader That assists with adding batch tasks to a WordPress website.\n\n## Installation\n\n### Using Composer\n\n`composer require underpin/batch-task-loader`\n\n### Manually\n\nThis plugin uses a built-in autoloader, so as long as it is required _before_\nUnderpin, it should work as-expected.\n\n`require_once(__DIR__ . '/underpin-batch-tasks/batch-tasks.php');`\n\n## Setup\n\n1. Install Underpin. See [Underpin Docs](https://www.github.com/underpin-wp/underpin)\n1. Register new batch tasks as-needed.\n\n## Batch tasks\n\nAs a plugin matures, the need to break a big task (like replacing the value of every record in a database) into\nsmaller tasks (replace 20 records until all are replaced) becomes commonplace.\n\nThe problem is, WordPress doesn't provide a way to create these tasks easily. This loader makes it possible to register\nand build your own batch tasks quickly.\n\n## Example\n\nA very basic example could look something like this.\n\n```php\n\\Underpin\\underpin()-\u003ebatch_tasks()-\u003eadd( 'example-batch', [\n    'description'             =\u003e 'A batch task that does nothing 20 times',\n    'name'                    =\u003e 'Batch Task Example',\n    'tasks_per_request'       =\u003e 50,\n    'stop_on_error'           =\u003e true,\n    'total_items'             =\u003e 1000,\n    'notice_message'          =\u003e 'Run the most pointless batch task ever made.',\n    'button_text'             =\u003e 'LETS GO.',\n    'capability'              =\u003e 'administrator',\n    'batch_id'                =\u003e 'example-batch',\n    'task_callback'           =\u003e '__return_null', // The callback that iterates on every task\n    'finish_process_callback' =\u003e '__return_null', // The callback that runs after everything is finished\n    'prepare_task_callback'   =\u003e '__return_null', // The callback that runs before each task\n    'finish_task_callback'    =\u003e '__return_null', // The callback that runs after each task\n  ] );\n```\n\nAlternatively, you can extend `batch task` and reference the extended class directly, like so:\n\n```php\nunderpin()-\u003ebatch_tasks()-\u003eadd('key','Namespace\\To\\Class');\n```\n\nThis is especially useful when using batch tasks, since they have a tendency to get quite long, and nest deep.\n\n## Enqueuing the batch notice\n\nOnce a batch task is registered, you can instruct Underpin to display the admin notice to run this task like so:\n\n```php\nUnderpin\\underpin()-\u003ebatch_tasks()-\u003eenqueue('example-batch');\n```\n\nThis will add a batch task notice to the admin area. Once clicked, the batch task will run, with a progress bar\nto indicate progress. When complete, it will self-close.\n\n![image](https://user-images.githubusercontent.com/8210827/116898675-87dcf080-abeb-11eb-9514-0f31566e90ca.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funderpin-wp%2Fbatch-task-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funderpin-wp%2Fbatch-task-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funderpin-wp%2Fbatch-task-loader/lists"}