How to delete page by deactivating plugin

Question

register_activation_hook( FILE, ‘myplugin_activate’ );

function myplugin_activate() {

//create a variable to specify the details of page

$post = array(

         'post_content'   => 'content', //content of page

         'post_title'     =>'Auto Page by activating plugin', //title of page
         'post_status'    =>  'publish' , //status of page - publish or draft
         'post_type'      =>  'page'  // type of post

);

wp_insert_post( $post ); // creates page

Above code is for creating page by activating plugin.

How to delete page by deactivating plugin?

0
, Muhammad Rizwan 3 years 2020-08-27T05:10:41-05:00 0 Answers 49 views 0

Leave an answer

Browse
Browse