WP API Cleanup
Cleanup data of WP using Rest API Endpoint. ie. posts, media, tags.
by Rahul Prajapati · github.com/rahulsprajapati/wp-api-cleanup · website
★ 1stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/rahulsprajapati/wp-api-cleanup/archive/refs/heads/master.zipCleanup data of WP using Rest API Endpoint. ie. posts, media, tags. Note: Usecase is to reset data before reimport using REST API.
Works like wp cli command: wp site empty --yes --uploads
How it works
- Register Endpoint:
wp-json/webhook/v1/cleanup - Delete all posts, media files and terms on
DELETErequest. With a token value which need to be set fromWP_API_CLEANUP_TOKENconstant.
Example:
Set constant in wp-config.php
define( 'WP_API_CLEANUP_TOKEN', 'token_value' );
Use:
https://example.com/wp-json/webhook/v1/cleanup with DELETE method and { token: 'token_value' } data.