Есть виджет который выводит категории с картинками, выводятся все картинки кроме первой, я и статично передовал в wp_get_attachment_image_src ид, но всеравно ничего не возврощает.
$title = apply_filters( 'widget_title', $instance['title'] );
$empty_category = apply_filters( 'widget_empty_category', $instance['empty_category'] );
$args = array(
'taxonomy' => 'product_cat',
'hide_empty' => false,
'orderby' => 'none',
'parent' => 0
);
$terms = get_terms( $args );
$array_terms= array();
foreach ($terms as $i => $term) {
if ($term->slug == 'uncategorized'){
continue;
}
$term_id = $term->term_id;
$image_url = wp_get_attachment_image_src( $term_id, 'full' )[0];
r($term_id);
$array_terms[$i] = ['name' => $term->name,'src' => $image_url,'child' => array()];
$argschild = array(
'taxonomy' => 'product_cat',
'hide_empty' => $empty_category == "on" ? true : false,
'orderby' => 'none',
'parent' => $term_id
);
$termschild = get_terms( $argschild );
foreach ($termschild as $child) {
$term_link = get_term_link($child);
$array_terms[$i]['child'][] = ['name' => $child->name, 'link' => $term_link];
}
}
wp_reset_query();
?>
<h3 class="text-center"><?php echo $title; ?></h3>
<div class="widjets">
<?php foreach ($array_terms as $term): ?>
<div class="widjet">
<div class="title"><img src="<?php echo $term['src']; ?>"><span class="cat_name"><?php echo $term['name']; ?></span></div>
<ul class="list_subcat">
<?php foreach ($term['child'] as $term_child): ?>
<li><a href="<?php echo $term_child['link']; ?>"><?php echo $term_child['name']; ?></a></li>
<?php endforeach ?>
</ul>
</div>
<?php endforeach; ?>
</div>