Create a admin settings screen to start the Regenerate Existing Images background job. This will be a new screen available under the 'Tools' menu and display basic settings to start the Regenerate Existing Images background job.
Acceptance Criteria
- Create a new admin settings screen under “Tools > Regenerate Images”
- This screen is only accessible to users with the
upload_files and manage_options capabilities.
- The screen will display the following on the page
- The title "Regenerate Existing Images"
- A brief description explaining the feature
- A basic form containing the following controls:
- A "Regenerate Images" button that will start the Regenerate Existing Images background job.
- A
delete_images checkbox to delete old images. By default the checkbox is unchecked.
- When the form is submitted, the POST request is handled by doing the following:
- Validate the form submission with
wp_verify_nonce
- Check the
delete_images checkbox value
- Create a new background job with the
perflab_create_background_job function passing the following
regenerate_images as the job name
array( 'delete_images' => $delete_images ) as the job data, passing the value of the delete_images checkbox as part of the data
- Using the
$job_id returned by perflab_start_background_job function
- Passing the newly created
$job_id returned by the perflab_create_background_job function
Create a admin settings screen to start the Regenerate Existing Images background job. This will be a new screen available under the 'Tools' menu and display basic settings to start the Regenerate Existing Images background job.
Acceptance Criteria
upload_filesandmanage_optionscapabilities.delete_imagescheckbox to delete old images. By default the checkbox is unchecked.wp_verify_noncedelete_imagescheckbox valueperflab_create_background_jobfunction passing the followingregenerate_imagesas the job namearray( 'delete_images' => $delete_images )as the job data, passing the value of thedelete_imagescheckbox as part of the data$job_idreturned byperflab_start_background_jobfunction$job_idreturned by theperflab_create_background_jobfunction