Skip Navigation

[Resolved] Custom Post Field – Type Image – .avif-Data

This thread is resolved. Here is a description of the problem and solution.

Problem:

The customer created a custom post field for images but was unable to upload AVIF format files to the field, despite AVIF images being supported elsewhere in their WordPress media library. They requested a solution to enable AVIF uploads in Toolset's custom image field.

Solution:

A code snippet was provided to extend the valid image file types for Toolset, allowing AVIF images. The customer added this code to their theme’s functions.php file or within Toolset > Settings >

function allow_avif_in_toolset( $valid_extensions ) {
    // Add AVIF to the list of valid extensions
    $valid_extensions[] = 'avif';
    return $valid_extensions;
}
add_filter( 'toolset_valid_image_extentions', 'allow_avif_in_toolset' );

This code successfully enabled the AVIF format in the custom image field, allowing the customer to upload AVIF images as intended.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 1 reply, has 2 voices.

Last updated by Mateus Getulio 1 month, 1 week ago.

Assisted by: Mateus Getulio.

Author
Posts
#2777199

Tell us what you are trying to do?
I created a custom post field with the type image.
Its working well with all the old image-formats like jpg,...
I want to upload .avif-Data (which is also a type of image) but its not working. I think its not supported yet!?
In my wordpress library i have a lot of avif-Data and its working fine at my website.

I hope you have a fast solution for this Problem. Upload jpges is not a solution 😉
Greetings

#2777306

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello there,

Thank you for contacting our support.

Can you please try to add the following code to your theme's functions.php file or to Toolset > Settings > Custom code to confirm it allows you to use avif images? I performed a test locally and I've been able to upload and save a post containing an avif image in its custom image field:

function allow_avif_in_toolset( $valid_extensions ) {
    // Add AVIF to the list of valid extensions
    $valid_extensions[] = 'avif';
    return $valid_extensions;
}
add_filter( 'toolset_valid_image_extentions', 'allow_avif_in_toolset' );

Thank you, please let us know.
Mateus

#2777336

Thank you very much! It works like a bat out of hell!