This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bulk_delete_posts(){ | |
$args = array( 'post_type' =>'post', 'posts_per_page' => -1, 'post_status' => 'any', 'fields' =>'ids'); | |
$books = get_posts( $args ); | |
foreach ($posts as $post) { | |
wp_delete_post( $post, true); | |
} | |
} | |
add_action( 'wp_head', 'bulk_delete_posts' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bulk_delete_comments(){ | |
$args = array('fields' => 'ids','number' => '','status' => 'all'); | |
$comments = get_comments( $args ); | |
foreach ($comments as $comment) { | |
wp_delete_comment( $comment, true); | |
} | |
} | |
add_action( 'wp_head', 'bulk_delete_comments' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bulk_delete_books(){ | |
$args = array( 'post_type' =>'book', 'posts_per_page' => -1, 'post_status' => 'any', 'fields' =>'ids'); | |
$books = get_posts( $args ); | |
foreach ($books as $book) { | |
wp_delete_post( $book, true); | |
} | |
} | |
add_action( 'wp_head', 'bulk_delete_books' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bulk_delete_revisions(){ | |
$args = array( 'post_type' =>'revision', 'posts_per_page' => -1, 'post_status' => 'any', 'fields' =>'ids'); | |
$revisions = get_posts( $args ); | |
foreach ($revisions as $revision) { | |
wp_delete_post( $revision, true); | |
} | |
} | |
add_action( 'wp_head', 'bulk_delete_revisions' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bulk_delete_spam_comments(){ | |
$args = array('fields' => 'ids','number' => '','status' => 'spam'); | |
$comments = get_comments( $args ); | |
foreach ($comments as $comment) { | |
wp_delete_comment( $comment, true); | |
} | |
} | |
add_action( 'wp_head', 'bulk_delete_spam_comments' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Sub CommandButton2_Click() | |
Dim CSVfolder As String, _ | |
XlsFolder As String, _ | |
fname As String, _ | |
wBook As Workbook | |
CSVfolder = "C:\csv\txt\" | |
XlsFolder = "C:\csv\xlsx\" | |
fname = Dir(CSVfolder & "*.txt") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function delete_empty_terms(){ | |
$taxonomy_name = 'city'; | |
$terms = get_terms( array( | |
'taxonomy' => $taxonomy_name, | |
'hide_empty' => false | |
) ); | |
foreach ( $terms as $term ) { | |
$term_count = $term->count; | |
if ($term_count < 1){ wp_delete_term($term->term_id, $taxonomy_name); | |
} |
OlderNewer