media - wp_get_attachment_image_src() returns wrong url

wp_get_attachment_image_src() is returning a wrong image url. It returns the original url instead of the cropped one. He

wp_get_attachment_image_src() is returning a wrong image url. It returns the original url instead of the cropped one. Here some example code:

    $ptId = get_post_thumbnail_id( $productId );
    print_r(wp_get_attachment_image_src( $ptId, 'thumbnail'));
    print_r(wp_get_attachment_image_src( $ptId, 'medium'));
    print_r(wp_get_attachment_image_src( $ptId, 'medium_large'));

Returns:

Array ( [0] => //localhost:3000/.../wp-content/uploads/2020/06/Mineral-Lipstick-Crème-Brûlée-scaled-1.jpg [1] => 100 [2] => 150 [3] => ) 
Array ( [0] => //localhost:3000/.../wp-content/uploads/2020/06/Mineral-Lipstick-Crème-Brûlée-scaled-1.jpg [1] => 200 [2] => 300 [3] => ) 
Array ( [0] => //localhost:3000/.../wp-content/uploads/2020/06/Mineral-Lipstick-Crème-Brûlée-scaled-1.jpg [1] => 768 [2] => 1152 [3] => )

The image sizes do exist and you can see that the function 'kind of' detects them. I've also regenerated them (both with wp-cli & the regenerate thumbnails plugin) just to be on the sure side but alas.

I don't quite get it, I've been using this function for years and suddenly I'm not getting the desired results. Any idea as to what might be going wrong?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742316071a4420861.html

相关推荐

  • media - wp_get_attachment_image_src() returns wrong url

    wp_get_attachment_image_src() is returning a wrong image url. It returns the original url instead of the cropped one. He

    13小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信