简体   繁体   English

在 WordPress 中上传特色图片时如何添加自定义宽度验证?

[英]How to add custom validation for width when uploading featured image in WordPress?

Is there a way to check image width/height when it is uploaded as featured image in WP post?在 WP 帖子中作为特色图片上传时,有没有办法检查图片的宽度/高度?

For example, I click 'set featured image', then Media tab opens, I go to 'Upload files' and try to upload a huge image and there is an error like 'The image is too big'.例如,我点击“设置特色图片”,然后媒体选项卡打开,我转到“上传文件”并尝试上传一张巨大的图片,但出现“图片太大”之类的错误。

Check this code检查此代码

add_image_size( 'amolood-featured-image', 90, 590, true );

width : 90宽度:90
height : 590身高:590

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM