Created
November 6, 2019 19:43
-
-
Save aliciaduffy/5e680adfc14ea8895276a2c70f83ee2a to your computer and use it in GitHub Desktop.
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
$taxonomy = get_term( $category_id )->taxonomy; | |
// get all post IDs within selected category | |
$posts_in_category = new WP_Query( array( | |
'fields' => 'ids', | |
'tax_query' => array( | |
array( | |
'taxonomy' => $taxonomy, | |
'terms' => $category_id, | |
), | |
) | |
) ); | |
foreach( $posts_in_category->posts as $cat_post ) { | |
// get total votes for each post in category - update their postmeta | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment