Skip to content

Instantly share code, notes, and snippets.

@taricco
Last active January 27, 2024 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taricco/f3ccde8a67aa4e2f3bd6be7234a58632 to your computer and use it in GitHub Desktop.
Save taricco/f3ccde8a67aa4e2f3bd6be7234a58632 to your computer and use it in GitHub Desktop.
/*** ACF 6.2.5 Security Fix
@link https://wpfieldwork.com/diving-into-acfs-latest-security-release/
–––––––––––––––––––––––––––––––––––––––––––––––––– ***/
add_filter('acf/shortcode/allow_unsafe_html', function ($allowed, $atts) {
// Array of field names that allow unsafe HTML
$allowed_fields = [
'global_after_body_code',
'footer_code',
'global_footer_code',
'header_code',
'global_header_code',
'homepage_footer_code',
'homepage_header_code'
];
// Check if the field is in the list of allowed fields
if (in_array($atts['field'], $allowed_fields)) {
return true;
}
// Return the default allowed state if not in the allowed fields
return $allowed;
}, 10, 2);
/*** ACF 6.2.5 Security Fix
@link https://wpfieldwork.com/diving-into-acfs-latest-security-release/
–––––––––––––––––––––––––––––––––––––––––––––––––– ***/
add_filter('acf/shortcode/allow_unsafe_html', function ($allowed, $atts) {
// Array of field names that allow unsafe HTML
$allowed_fields = [
'hide-header-navigation',
'hide-footer',
'show-notification-bar-link',
'notification-bar-link'
];
// Check if the field is in the list of allowed fields
if (in_array($atts['field'], $allowed_fields)) {
return true;
}
// Return the default allowed state if not in the allowed fields
return $allowed;
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment