If you want to delete Custom Post Type Data/Posts then this Plugin will help you in deleting the required posts.So have a look at the Plugin that how does it works.
<?php
/*
Plugin Name: CPT Data Cleaner
Author: <a href="http://anwarkhan.co.nf">Anwar</a>
Description: This is a starter Plugin developed by Skyline IT Solutions.
Author URI: http://anwarkhan.co.nf
Version: 1.0
License: GPL2
*/
?>
<?php
function delete(){
$delete_post = array(
'post_type' => 'movies',
'name' => $title,
'post_status' => 'publish',
'post_author' => $current_user->ID
);
$posts = new WP_Query( $delete_post );
if ( $posts->have_posts() ) {
while ( $posts->have_posts() ) {
$posts->the_post();
wp_delete_post( get_the_ID());
}
}
}
add_action( 'admin_menu', 'delete' );
?>
<?php
/*
Plugin Name: CPT Data Cleaner
Author: <a href="http://anwarkhan.co.nf">Anwar</a>
Description: This is a starter Plugin developed by Skyline IT Solutions.
Author URI: http://anwarkhan.co.nf
Version: 1.0
License: GPL2
*/
?>
<?php
function delete(){
$delete_post = array(
'post_type' => 'movies',
'name' => $title,
'post_status' => 'publish',
'post_author' => $current_user->ID
);
$posts = new WP_Query( $delete_post );
if ( $posts->have_posts() ) {
while ( $posts->have_posts() ) {
$posts->the_post();
wp_delete_post( get_the_ID());
}
}
}
add_action( 'admin_menu', 'delete' );
?>
Comments
Post a Comment