Theme options, content filter, span

Stagger Lee
1818 Posts
Stagger Lee posted this 14 March 2017

Maybe I am doing this wrong. Added span in list of allowed content filters in Theme Options. And it is not respected.
Content is displayed via shortcode. I see all other allowed tags are respected.

Span = Font size, text color, of text with TinyMce

Maybe I am doing this wrong. Added span in list of allowed content filters in Theme Options. And it is not respected. Content is displayed via shortcode. I see all other allowed tags are respected. Span = Font size, text color, of text with TinyMce
Vote to pay developers attention to this features or issue.
1 Comments
Order By: Standard | Newest
Stagger Lee
1818 Posts
Is Solution
Stagger Lee posted this 14 March 2017

Solved. Remains of this snippet made problem. Will never use it again.

/* ======================================================================
 * Removes inline styles and other coding junk added by the WYSIWYG editor.
 * ====================================================================== */
add_filter( 'the_content', 'clean_post_content' );
function clean_post_content($content) {


    // Remove inline styling
    $content = preg_replace('/(<[^>]+) style=".*?"/i', '$1', $content);


    // Remove font tag
    $content = preg_replace('/<font[^>]+>/', '', $content);


    // Remove empty tags
    $post_cleaners = array('<p></p>' => '', '<p> </p>' => '', '<p>&nbsp;</p>' => '', '<span></span>' => '', '<span> </span>' => '', '<span>&nbsp;</span>' => '', '<span>' => '', '</span>' => '', '<font>' => '', '</font>' => '');
    $content = strtr($content, $post_cleaners);


    return $content;
}

Solved. Remains of this snippet made problem. Will never use it again. /* ====================================================================== * Removes inline styles and other coding junk added by the WYSIWYG editor. * ====================================================================== */ add_filter( 'the_content', 'clean_post_content' ); function clean_post_content($content) { // Remove inline styling $content = preg_replace('/(<[^>]+) style=".*?"/i', '$1', $content); // Remove font tag $content = preg_replace('/<font[^>]+>/', '', $content); // Remove empty tags $post_cleaners = array('<p></p>' => '', '<p> </p>' => '', '<p>&nbsp;</p>' => '', '<span></span>' => '', '<span> </span>' => '', '<span>&nbsp;</span>' => '', '<span>' => '', '</span>' => '', '<font>' => '', '</font>' => ''); $content = strtr($content, $post_cleaners); return $content; }
You must log in or register to leave comments