fix: reuse CHRNX term caches

This commit is contained in:
chrnx committed 2026-08-11 16:18:57 -05:00
1 parent 0226a52119
commit ea62e9535d
2 files changed
+48 -2

No files matched your search

+6 -2
View File
@@ -153,8 +153,12 @@ function chrnx_get_eligible_editorial_post_ids( $extra_args = array() ) {
* @return string Topic slug or empty string.
*/
function chrnx_get_post_topic_slug( $post_id ) {
$terms = wp_get_object_terms( $post_id, 'chrnx_topic', array( 'fields' => 'slugs' ) );
return ! is_wp_error( $terms ) && ! empty( $terms ) ? (string) reset( $terms ) : '';
$terms = get_the_terms( $post_id, 'chrnx_topic' );
if ( is_wp_error( $terms ) || empty( $terms ) ) {
return '';
}
$term = reset( $terms );
return $term instanceof WP_Term ? (string) $term->slug : '';
}
/**