WP Manifestindependent plugin directory
manifest / developer / wp-api-cleanup

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.zip

Cleanup 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

  1. Register Endpoint: wp-json/webhook/v1/cleanup
  2. Delete all posts, media files and terms on DELETE request. With a token value which need to be set from WP_API_CLEANUP_TOKEN constant.

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.