Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* Plugin Name: Allow ACF Content
* Plugin URI: https://develop.tadpole.cc/plugins/tc-allow-acf-content
* Description: Allow unfiltered ACF Content
* Author: Kevin Cristiano
* Text Domain: tc-allow-acf-content
* Domain Path: /languages
* Version: 0.1.0
*
* @package Tc_Acf_Allow_Content
*/
/**
* Add filter to enable ACF escaping for testing
* This will be the default in 6.2.7+
*/
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
* Chnage selector to ACF field slug
*/
add_filter( 'acf/the_field/allow_unsafe_html', function( $allowed, $selector ) {
if ( $selector === "intro" ) {
return true;
}
return $allowed;
}, 10, 2);
/**
* 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
*/
add_filter( 'acf/shortcode/allow_unsafe_html', function ( $allowed, $atts ) {
if ( $atts['field'] === 'podcast_iframe' ) {
return true;
}
return $allowed;
}, 10, 2 );