Created
March 17, 2018 18:07
-
-
Save xnau/79a15f5942c29aa2e8fc17520b3d8ba0 to your computer and use it in GitHub Desktop.
Shows how to bypass the HTML tag filters on a Participants Database text field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* bypass HTML sanitizing on the "home_page" field | |
* | |
* @param string $text the sanitized text | |
* @param object $field the current field object | |
* @return string the display string | |
*/ | |
function xnau_bypass_homepage_field_sanitize( $text, $field ) { | |
if ( $field->name === 'home_page' ) { | |
// wp_kses_post() allows some safe HTML for frontend content | |
$text = wp_kses_post( $field->value ); // use the unsanitized value | |
} | |
return $text; | |
} | |
add_filter( 'pdb-text_field_output', 'xnau_bypass_homepage_field_sanitize', 10, 2 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment