Home › Forums › General Issues › Is it possible to add custom image sizes only for a given image custom field? › Reply To: Is it possible to add custom image sizes only for a given image custom field?
There is a way to not generate sizes during the ACF upload, but I don’t think that it can be changed to only generate those sizes during that upload.
To not generate sizes during the ACF upload you can use an acf/upload_prefilter filter and in that filter you can add a filter as described here in the section titled Stop Generating Image Sizes Through Adding a code to functions.php.
It might be possible to disable generating a specific size as a general rule and only allow them to be generated during the ACF upload. However, this would depend on what values are available in the $_POST array and if you can detect that the upload is for an ACF field. I do not know what is included in $_POST during an ACF image upload or if there is any way to determine that the upload is for an ACF field or not.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
ACF wouldn’t be so widely used in WordPress if it didn’t have some pretty amazing capabilities. In this article, we look at a few of the features we’ll discuss during “7 things you didn’t know you could do with ACF” at #WPEDecode later this month. https://t.co/5lnsTxp81j pic.twitter.com/Yf0ThPG1QG
— Advanced Custom Fields (@wp_acf) March 16, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.