WordPress Category-Template.php Line 1158 Error
/**
* Find this code snippet
*/
function get_the_terms( $post, $taxonomy ) {
if ( ! $post = get_post( $post ) )
return false;
$terms = get_object_term_cache( $post->ID, $taxonomy );
if ( false === $terms ) {
$terms = wp_get_object_terms( $post->ID, $taxonomy );
$to_cache = array();
foreach ( $terms as $key => $term ) {
$to_cache[ $key ] = $term->data;
}
wp_cache_add( $post->ID, $to_cache, $taxonomy . '_relationships' );
}
$terms = array_map( 'get_term', $terms );
Replace with this code snippet
/**
* Replace with this code snippet
*/
function get_the_terms( $post, $taxonomy ) {
if ( ! $post = get_post( $post ) )
return false;
$terms = get_object_term_cache( $post->ID, $taxonomy );
if ( false === $terms ) {
$terms = wp_get_object_terms( $post->ID, $taxonomy );
if ( ! is_wp_error( $terms ) ) {
$to_cache = array();
foreach ( $terms as $key => $term ) {
$to_cache[ $key ] = $term->data;
}
wp_cache_add( $post->ID, $to_cache, $taxonomy . '_relationships' );
}
}
if ( ! is_wp_error( $terms ) ) {
$terms = array_map( 'get_term', $terms );
}
Share Your Two Cents