Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active November 3, 2015 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/fd9b7d7c327406bb4d09 to your computer and use it in GitHub Desktop.
Save billerickson/fd9b7d7c327406bb4d09 to your computer and use it in GitHub Desktop.
<?php
/**
* Delete share count data
*
*/
function be_delete_share_count_data() {
$loop = new WP_Query( array(
'posts_per_page' => 100,
'meta_key' => 'ea_share_count',
'fields' => 'ids',
) );
if( $loop->have_posts() ):
foreach( $loop->posts as $post_id ) {
delete_post_meta( $post_id, 'ea_share_count' );
delete_post_meta( $post_id, 'ea_share_count_datetime' );
delete_post_meta( $post_id, 'ea_share_count_total' );
}
endif;
}
add_action( 'wp_footer', 'be_delete_share_count_data' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment