Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Add Shortcode
- function clean_html_shortcode( $atts , $content = null ) {
- global $allowedposttags;
- if ( isset( $content, $allowedposttags ) && is_array( $allowedposttags ) ) {
- /**
- * Allowed attributes
- *
- * @var array
- */
- $allowed_html = array(
- 'a' => array( 'href' => true ),
- 'img' => array( 'src' => true ),
- );
- /**
- * Get all tags and define without any attributes
- */
- foreach ( $allowedposttags as $tag_name => $attrs ) {
- if ( ! isset( $allowed_html[ $tag_name ] ) ) {
- $allowed_html[ $tag_name ] = array();
- }
- }
- return wp_kses( $content, $allowed_html );
- }
- }
- add_shortcode( 'clean_html', 'clean_html_shortcode' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement