Не понимает размер превью, ошибка в meta.php
-
Не понимает какой размер превью выводить и ругается на строку meta.php
wp-includes/meta.php
функция get_metadata_rowучасток кода:
$check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single, $meta_type ); if ( null !== $check ) { if ( $single && is_array( $check ) ) { return $check[0]; } else { return $check; } }
Если провезти анализ, то можно понять что условие попадает в $single и $check является массивом вида:
array(5) { ["width"]=> int(1024) ["height"]=> int(1448) ["file"]=> string(19) "2022/03/testimg.png" ["sizes"]=> array(17) { ["medium"]=> array(4) { ["file"]=> string(19) "testimg-212x300.png" ["width"]=> int(212) ["height"]=> int(300) ["mime-type"]=> string(9) "image/png" } ["large"]=> array(4) { ["file"]=> string(20) "testimg-724x1024.png" ["width"]=> int(724) ["height"]=> int(1024) ["mime-type"]=> string(9) "image/png" } ["thumbnail"]=> array(4) { ["file"]=> string(19) "testimg-300x300.png" ["width"]=> int(300) ["height"]=> int(300) ["mime-type"]=> string(9) "image/png" } ["medium_large"]=> array(4) { ["file"]=> string(20) "testimg-768x1086.png" ["width"]=> int(768) ["height"]=> int(1086) ["mime-type"]=> string(9) "image/png" } ["catalog-thumb"]=> array(4) { ["file"]=> string(19) "testimg-400x400.png" ["width"]=> int(400) ["height"]=> int(400) ["mime-type"]=> string(9) "image/png" } ["catalog-color"]=> array(4) { ["file"]=> string(19) "testimg-190x100.png" ["width"]=> int(190) ["height"]=> int(100) ["mime-type"]=> string(9) "image/png" } ["Shop_thumbnail"]=> array(4) { ["file"]=> string(19) "testimg-300x300.png" ["width"]=> int(300) ["height"]=> int(300) ["mime-type"]=> string(9) "image/png" } ["electro_blog_small"]=> array(4) { ["file"]=> string(19) "testimg-430x245.png" ["width"]=> int(430) ["height"]=> int(245) ["mime-type"]=> string(9) "image/png" } ["electro_blog_medium"]=> array(4) { ["file"]=> string(19) "testimg-870x460.png" ["width"]=> int(870) ["height"]=> int(460) ["mime-type"]=> string(9) "image/png" } ["electro_blog_large"]=> array(4) { ["file"]=> string(20) "testimg-1024x615.png" ["width"]=> int(1024) ["height"]=> int(615) ["mime-type"]=> string(9) "image/png" } ["electro_blog_carousel"]=> array(4) { ["file"]=> string(19) "testimg-270x180.png" ["width"]=> int(270) ["height"]=> int(180) ["mime-type"]=> string(9) "image/png" } ["woocommerce_thumbnail"]=> array(5) { ["file"]=> string(19) "testimg-300x300.png" ["width"]=> int(300) ["height"]=> int(300) ["mime-type"]=> string(9) "image/png" ["uncropped"]=> bool(false) } ["woocommerce_single"]=> array(4) { ["file"]=> string(19) "testimg-600x848.png" ["width"]=> int(600) ["height"]=> int(848) ["mime-type"]=> string(9) "image/png" } ["woocommerce_gallery_thumbnail"]=> array(4) { ["file"]=> string(19) "testimg-100x100.png" ["width"]=> int(100) ["height"]=> int(100) ["mime-type"]=> string(9) "image/png" } ["shop_catalog"]=> array(4) { ["file"]=> string(19) "testimg-300x300.png" ["width"]=> int(300) ["height"]=> int(300) ["mime-type"]=> string(9) "image/png" } ["shop_single"]=> array(4) { ["file"]=> string(19) "testimg-600x848.png" ["width"]=> int(600) ["height"]=> int(848) ["mime-type"]=> string(9) "image/png" } ["shop_thumbnail"]=> array(4) { ["file"]=> string(19) "testimg-100x100.png" ["width"]=> int(100) ["height"]=> int(100) ["mime-type"]=> string(9) "image/png" } } ["image_meta"]=> array(12) { ["aperture"]=> string(1) "0" ["credit"]=> string(0) "" ["camera"]=> string(0) "" ["caption"]=> string(0) "" ["created_timestamp"]=> string(1) "0" ["copyright"]=> string(0) "" ["focal_length"]=> string(1) "0" ["iso"]=> string(1) "0" ["shutter_speed"]=> string(1) "0" ["title"]=> string(0) "" ["orientation"]=> string(1) "0" ["keywords"]=> array(0) { } } } array(5) { ["width"]=> int(1024) ["height"]=> int(1448) ["file"]=> string(19) "2022/03/testimg.png" ["sizes"]=> array(17) { ["medium"]=> array(4) { ["file"]=> string(19) "testimg-212x300.png" ["width"]=> int(212) ["height"]=> int(300) ["mime-type"]=> string(9) "image/png" } ["large"]=> array(4) { ["file"]=> string(20) "testimg-724x1024.png" ["width"]=> int(724) ["height"]=> int(1024) ["mime-type"]=> string(9) "image/png" } ["thumbnail"]=> array(4) { ["file"]=> string(19) "testimg-300x300.png" ["width"]=> int(300) ["height"]=> int(300) ["mime-type"]=> string(9) "image/png" } ["medium_large"]=> array(4) { ["file"]=> string(20) "testimg-768x1086.png" ["width"]=> int(768) ["height"]=> int(1086) ["mime-type"]=> string(9) "image/png" } ["catalog-thumb"]=> array(4) { ["file"]=> string(19) "testimg-400x400.png" ["width"]=> int(400) ["height"]=> int(400) ["mime-type"]=> string(9) "image/png" } ["catalog-color"]=> array(4) { ["file"]=> string(19) "testimg-190x100.png" ["width"]=> int(190) ["height"]=> int(100) ["mime-type"]=> string(9) "image/png" } ["Shop_thumbnail"]=> array(4) { ["file"]=> string(19) "testimg-300x300.png" ["width"]=> int(300) ["height"]=> int(300) ["mime-type"]=> string(9) "image/png" } ["electro_blog_small"]=> array(4) { ["file"]=> string(19) "testimg-430x245.png" ["width"]=> int(430) ["height"]=> int(245) ["mime-type"]=> string(9) "image/png" } ["electro_blog_medium"]=> array(4) { ["file"]=> string(19) "testimg-870x460.png" ["width"]=> int(870) ["height"]=> int(460) ["mime-type"]=> string(9) "image/png" } ["electro_blog_large"]=> array(4) { ["file"]=> string(20) "testimg-1024x615.png" ["width"]=> int(1024) ["height"]=> int(615) ["mime-type"]=> string(9) "image/png" } ["electro_blog_carousel"]=> array(4) { ["file"]=> string(19) "testimg-270x180.png" ["width"]=> int(270) ["height"]=> int(180) ["mime-type"]=> string(9) "image/png" } ["woocommerce_thumbnail"]=> array(5) { ["file"]=> string(19) "testimg-300x300.png" ["width"]=> int(300) ["height"]=> int(300) ["mime-type"]=> string(9) "image/png" ["uncropped"]=> bool(false) } ["woocommerce_single"]=> array(4) { ["file"]=> string(19) "testimg-600x848.png" ["width"]=> int(600) ["height"]=> int(848) ["mime-type"]=> string(9) "image/png" } ["woocommerce_gallery_thumbnail"]=> array(4) { ["file"]=> string(19) "testimg-100x100.png" ["width"]=> int(100) ["height"]=> int(100) ["mime-type"]=> string(9) "image/png" } ["shop_catalog"]=> array(4) { ["file"]=> string(19) "testimg-300x300.png" ["width"]=> int(300) ["height"]=> int(300) ["mime-type"]=> string(9) "image/png" } ["shop_single"]=> array(4) { ["file"]=> string(19) "testimg-600x848.png" ["width"]=> int(600) ["height"]=> int(848) ["mime-type"]=> string(9) "image/png" } ["shop_thumbnail"]=> array(4) { ["file"]=> string(19) "testimg-100x100.png" ["width"]=> int(100) ["height"]=> int(100) ["mime-type"]=> string(9) "image/png" } } ["image_meta"]=> array(12) { ["aperture"]=> string(1) "0" ["credit"]=> string(0) "" ["camera"]=> string(0) "" ["caption"]=> string(0) "" ["created_timestamp"]=> string(1) "0" ["copyright"]=> string(0) "" ["focal_length"]=> string(1) "0" ["iso"]=> string(1) "0" ["shutter_speed"]=> string(1) "0" ["title"]=> string(0) "" ["orientation"]=> string(1) "0" ["keywords"]=> array(0) { } } } array(5) { ["width"]=> int(1024) ["height"]=> int(1448) ["file"]=> string(19) "2022/03/testimg.png" ["sizes"]=> array(17) { ["medium"]=> array(4) { ["file"]=> string(19) "testimg-212x300.png" ["width"]=> int(212) ["height"]=> int(300) ["mime-type"]=> string(9) "image/png" } ["large"]=> array(4) { ["file"]=> string(20) "testimg-724x1024.png" ["width"]=> int(724) ["height"]=> int(1024) ["mime-type"]=> string(9) "image/png" } ["thumbnail"]=> array(4) { ["file"]=> string(19) "testimg-300x300.png" ["width"]=> int(300) ["height"]=> int(300) ["mime-type"]=> string(9) "image/png" } ["medium_large"]=> array(4) { ["file"]=> string(20) "testimg-768x1086.png" ["width"]=> int(768) ["height"]=> int(1086) ["mime-type"]=> string(9) "image/png" } ["catalog-thumb"]=> array(4) { ["file"]=> string(19) "testimg-400x400.png" ["width"]=> int(400) ["height"]=> int(400) ["mime-type"]=> string(9) "image/png" } ["catalog-color"]=> array(4) { ["file"]=> string(19) "testimg-190x100.png" ["width"]=> int(190) ["height"]=> int(100) ["mime-type"]=> string(9) "image/png" } ["Shop_thumbnail"]=> array(4) { ["file"]=> string(19) "testimg-300x300.png" ["width"]=> int(300) ["height"]=> int(300) ["mime-type"]=> string(9) "image/png" } ["electro_blog_small"]=> array(4) { ["file"]=> string(19) "testimg-430x245.png" ["width"]=> int(430) ["height"]=> int(245) ["mime-type"]=> string(9) "image/png" } ["electro_blog_medium"]=> array(4) { ["file"]=> string(19) "testimg-870x460.png" ["width"]=> int(870) ["height"]=> int(460) ["mime-type"]=> string(9) "image/png" } ["electro_blog_large"]=> array(4) { ["file"]=> string(20) "testimg-1024x615.png" ["width"]=> int(1024) ["height"]=> int(615) ["mime-type"]=> string(9) "image/png" } ["electro_blog_carousel"]=> array(4) { ["file"]=> string(19) "testimg-270x180.png" ["width"]=> int(270) ["height"]=> int(180) ["mime-type"]=> string(9) "image/png" } ["woocommerce_thumbnail"]=> array(5) { ["file"]=> string(19) "testimg-300x300.png" ["width"]=> int(300) ["height"]=> int(300) ["mime-type"]=> string(9) "image/png" ["uncropped"]=> bool(false) } ["woocommerce_single"]=> array(4) { ["file"]=> string(19) "testimg-600x848.png" ["width"]=> int(600) ["height"]=> int(848) ["mime-type"]=> string(9) "image/png" } ["woocommerce_gallery_thumbnail"]=> array(4) { ["file"]=> string(19) "testimg-100x100.png" ["width"]=> int(100) ["height"]=> int(100) ["mime-type"]=> string(9) "image/png" } ["shop_catalog"]=> array(4) { ["file"]=> string(19) "testimg-300x300.png" ["width"]=> int(300) ["height"]=> int(300) ["mime-type"]=> string(9) "image/png" } ["shop_single"]=> array(4) { ["file"]=> string(19) "testimg-600x848.png" ["width"]=> int(600) ["height"]=> int(848) ["mime-type"]=> string(9) "image/png" } ["shop_thumbnail"]=> array(4) { ["file"]=> string(19) "testimg-100x100.png" ["width"]=> int(100) ["height"]=> int(100) ["mime-type"]=> string(9) "image/png" } } ["image_meta"]=> array(12) { ["aperture"]=> string(1) "0" ["credit"]=> string(0) "" ["camera"]=> string(0) "" ["caption"]=> string(0) "" ["created_timestamp"]=> string(1) "0" ["copyright"]=> string(0) "" ["focal_length"]=> string(1) "0" ["iso"]=> string(1) "0" ["shutter_speed"]=> string(1) "0" ["title"]=> string(0) "" ["orientation"]=> string(1) "0" ["keywords"]=> array(0) { } } } array(5) { ["width"]=> int(1024) ["height"]=> int(1448) ["file"]=> string(19) "2022/03/testimg.png" ["sizes"]=> array(17) { ["medium"]=> array(4) { ["file"]=> string(19) "testimg-212x300.png" ["width"]=> int(212) […
но return $check[0]; возвращает NULL и картинка ставится стандартная (оригинал). Если же убрать [0] и возвращать весь массив, то все отрабатывает на ура и картинка подгоняется под заданные размеры. Из-за чего такое может возникать и как с этим можно побороться не залезая в код Вордпресса?) Подскажите умную мысль пожалуйста
Просмотр 3 ответов — с 1 по 3 (всего 3)
Просмотр 3 ответов — с 1 по 3 (всего 3)
- Тема «Не понимает размер превью, ошибка в meta.php» закрыта для новых ответов.