Created
May 28, 2021 18:43
-
-
Save pbearne/03c7d61604ecb8aac913d4eafd16af39 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
add_action( 'init', function (){ | |
if( isset( $_REQUEST['count_terms'] ) ){ | |
$update_taxonomies = get_taxonomies(['object_type' => ['matador-job-listings']]); | |
foreach ($update_taxonomies as $update_taxonomy) { | |
$get_terms_args = array( | |
'taxonomy' => $update_taxonomy, | |
'fields' => 'ids', | |
'hide_empty' => false, | |
); | |
$update_terms = get_terms($get_terms_args); | |
echo $update_taxonomy . ' has ' . count( $update_terms ) .' terms' . PHP_EOL . PHP_EOL; | |
wp_update_term_count_now( $update_terms, $update_taxonomy ); | |
} | |
die(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment