WordPress.org

Ready to get started?Download WordPress

Forums

SubHeading
[resolved] Span classes being stripped. (2 posts)

  1. mpmchugh
    Member
    Posted 1 year ago #

    I added the following to allow for br and span tags with classes, but the classes keep getting stripped.

    add_filter( 'subheading_tags', function( $tags ) {
     	$tags['span'] = array('class');
     	$tags['br'] = array();
        return $tags;
    } );

    Did I do it wrong?

    Also, should class names be in quotes? I tried with single, with double and none. All got stripped.

    Just trying to do something like this:

    <span class="home1st">Lorem ipsum dolor sit amet,</span><span class="home2nd">consectetuer adipiscing elit.</span>

    But I get this after saving:

    <span>Lorem ipsum dolor sit amet,</span><span>consectetuer adipiscing elit.</span>

    http://wordpress.org/extend/plugins/subheading/

  2. Steve
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    Referring back to the WordPress documentation, it looks as though I may have including some slightly incorrect / misleading information in the Frequently Asked Questions relating to this topic.

    It should be possible to adjust your snippet to use 'class' as an array key rather than value, therefore something along the lines of this should help:

    add_filter( 'subheading_tags', function( $tags ) {
     	$tags['span'] = array('class' => array());
     	$tags['br'] = array();
        return $tags;
    } );

    I have also adjusted the readme file for the next release to reflect this - hope it helps.

    - Steve

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.