Skip to content

Instantly share code, notes, and snippets.

@xnau
Created March 17, 2018 18:07
Show Gist options
  • Save xnau/79a15f5942c29aa2e8fc17520b3d8ba0 to your computer and use it in GitHub Desktop.
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
<?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