Don’t think I have the ability to do that.
That said – technically my ask for a workaround is solved. Someone else can open a ticket asking for a revert.
Support got back to me very quickly! The fix is as follows:
/**
* Allow PDFs in ACF Gallery fields (ACF 6.8.7+).
*
* ACF 6.8.7 added server-side enforcement that restricts Image and Gallery
* fields to image files only. These three filters restore PDF support while
* leaving the image-only restriction in place for every other file type.
*
* To target a single gallery field instead of all gallery fields, replace
* /type=gallery with /key=field_XXXXXXXX in all three filter tags.
*/
add_filter( ‘acf/get_image_mime_types/type=gallery’, function( $mimes ) {
return $mimes + array( ‘mp4’ => ‘video/mp4’ );
} );add_filter( ‘acf/validate_is_image_attachment/type=gallery’, function( $errors, $file, $attachment ) {
$type = ! empty( $attachment[‘id’] )
? get_post_mime_type( $attachment[‘id’] )
: ( wp_check_filetype( $attachment[‘name’] ?? ” )[‘type’] ?? ( $attachment[‘mime’] ?? $attachment[‘type’] ?? ” ) );if ( ‘video/mp4’ === $type ) {
unset( $errors[‘invalid_image’] );
}return $errors;
}, 10, 3 );add_filter( ‘acf/validate_value/type=gallery’, function( $valid, $value, $field, $input ) {
if ( true === $valid || ! is_array( $value ) ) {
return $valid;
}foreach ( $value as $id ) {
if ( ! is_numeric( $id ) ) {
return $valid;
}if ( ! wp_attachment_is_image( $id ) && ‘video/mp4’ !== get_post_mime_type( $id ) ) {
return $valid;
}
}$min = (int) ( $field[‘min’] ?? 0 );
if ( $min && count( $value ) < $min ) {
return sprintf(
_n( ‘%1$s requires at least %2$s selection’, ‘%1$s requires at least %2$s selections’, $min, ‘acf’ ),
$field[‘label’],
$min
);
}return true;
}, 20, 4 );
Just an FYI – none of the ACF repeater options (table, block or row) work on a mobile platform where the viewport is smaller than 450px. You can tweak the css but it’s cumbersome and doesn’t work so well. A work around is to wrap the repeater field (under Wrapper Attributes) with a class and then set that class to scroll. For example – wrap the repeater with the class “scrollme” and then style that class as:
.scrollme {
overflow-y: auto;
padding: 10px 0;
}
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.