Skip to content

Instantly share code, notes, and snippets.

@kellenmace
Last active February 27, 2020 11:55
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 kellenmace/938ef95049819b6a1978422d41ea2d7f to your computer and use it in GitHub Desktop.
Save kellenmace/938ef95049819b6a1978422d41ea2d7f to your computer and use it in GitHub Desktop.
<?php
function delete_all_post_count_transients() {
$post_types = get_post_types();
$years = get_all_possible_years();
$months = get_all_possible_months();
foreach ( $post_types as $post_type ) {
foreach ( $years as $year ) {
foreach ( $months as $month ) {
$transient_key = "km_post_count_{$post_type}_{$year}_{$month}";
delete_transient( $transient_key );
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment