get_term_meta_from_cache: Source code

By the Web Warlock, Wednesday, 4/Aug/2010 9:52

<?php function get_term_meta_from_cache( $term_id , $key ){
	if( !( $term_meta = wp_cache_get( $term_id , 'termmeta' ) ) ){
		$term_meta = (array)get_term_custom( $term_id , NULL , array( 'force_query' => true , 'unfiltered' => true ) ) ;
		wp_cache_set( $term_id , $term_meta , 'termmeta' );
	};
	$results=array() ;
	foreach( $term_meta as $term_data ){
		if( $term_data->meta_key == $key ) $results[] = $term_data->meta_value ;
	} ;
	return $results ;
} ; ?>

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment