Skip to content
Snippets Groups Projects
Verified Commit 34222825 authored by Kevin Cristiano's avatar Kevin Cristiano :earth_americas:
Browse files

add more comments and a readme file

parent cc543ccc
No related branches found
No related tags found
No related merge requests found
# Allow Unfiltered ACF Content
See https://www.advancedcustomfields.com/blog/acf-6-2-5-security-release/
- Starting in 6.2.7 ACF will strip unsafe content from `the_field`, `the_subfield`, and shortcodes
- We can test early by applying a filter
- We can disable the filtering for trusted fields via a filter
This plugin will enable the chanmges before they are released via `add_filter( 'acf/the_field/escape_html_optin', '__return_true' );`
This is done to see what will occur on sites.
If we have trusted content that we don not want ACF to filter, we can exclude by filtering one field or shortcode at a time.
\ No newline at end of file
...@@ -19,7 +19,8 @@ add_filter( 'acf/the_field/escape_html_optin', '__return_true' ); ...@@ -19,7 +19,8 @@ add_filter( 'acf/the_field/escape_html_optin', '__return_true' );
/** /**
* Add filter to allow unfiltered HTML for the_field based on https://www.advancedcustomfields.com/blog/acf-6-2-5-security-release/#conditionally-disabling-the-new-behavior * Add filter to allow unfiltered HTML for the_field based on https://www.advancedcustomfields.com/blog/acf-6-2-5-security-release/#conditionally-disabling-the-new-behavior
* Chnage selector to ACF field slug * Change selector to ACF field slug
* Add one filter for each field
*/ */
add_filter( 'acf/the_field/allow_unsafe_html', function( $allowed, $selector ) { add_filter( 'acf/the_field/allow_unsafe_html', function( $allowed, $selector ) {
if ( $selector === "intro" ) { if ( $selector === "intro" ) {
...@@ -31,6 +32,7 @@ add_filter( 'acf/the_field/allow_unsafe_html', function( $allowed, $selector ) { ...@@ -31,6 +32,7 @@ add_filter( 'acf/the_field/allow_unsafe_html', function( $allowed, $selector ) {
/** /**
* Add filter to allow unfiltered HTML for ACF Shortcodes based on https://www.advancedcustomfields.com/blog/acf-6-2-5-security-release/#conditionally-disabling-the-new-behavior * Add filter to allow unfiltered HTML for ACF Shortcodes based on https://www.advancedcustomfields.com/blog/acf-6-2-5-security-release/#conditionally-disabling-the-new-behavior
* Change $atts['field'] to ACF Field Slug * Change $atts['field'] to ACF Field Slug
* * Add one filter for each shortcode
*/ */
add_filter( 'acf/shortcode/allow_unsafe_html', function ( $allowed, $atts ) { add_filter( 'acf/shortcode/allow_unsafe_html', function ( $allowed, $atts ) {
if ( $atts['field'] === 'podcast_iframe' ) { if ( $atts['field'] === 'podcast_iframe' ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment