'fb_scheduled_imports', 'posts_per_page' => -1, ); $scheduled_imports = get_posts( $scheduled_import_args ); if( !empty( $scheduled_imports ) ){ foreach ( $scheduled_imports as $import ) { if( $import->ID != '' ){ wp_delete_post( $import->ID, true ); } } } // Remove import History $ife_import_history_args = array( 'post_type' => 'ife_import_history', 'posts_per_page' => -1, ); $ife_import_history = get_posts( $ife_import_history_args ); if( !empty( $ife_import_history ) ){ foreach ( $ife_import_history as $history ) { if( $history->ID != '' ){ wp_delete_post( $history->ID, true ); } } } }