WordPress /wp-includes/category-template.php on line 1158 hatası
Wordpress 4.4.Güncellemesinden sonra özellikle woocommerce eklentili temalarda
Warning: array_map(): Argument #2 should be an array in…../public_html/……/wp-includes/category-template.php on line 1158
Hatası oluşmaktadır hatayı düzeltmek için sitemizdeki wp-includes/category-template.php dosyasını aşağıdaki kodların değişimiyle düzeltebilirsiniz.
category-template.php
dosyamızdaki 1144 satırı dahil 1158 satıra kadar vereceğimiz kod ile değiştiriniz.
Orjinal Kod
Resimde Görülen Kodu Aşağıdaki Kod İle Değiştirin Değiştirin
function get_the_terms( $post, $taxonomy ) {
$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’ );
}
}
$terms = array_map( ‘get_term’, $terms );