1

Background

I have a custom element in a page, which has a tagname of: column-set.

On the front end, that gets written as <column -set="">.

enter image description here

Question

Why is this happening, and can it be changed? (I suspect it might have something to do with wpautop)

Edit: More Info

I've found that kses might be the issue here. So I've added this to my functions.php file:

add_action( 'init', 'allow_custom_elem' );

function allow_custom_elem() {

    global $allowedposttags;

    $tags = [ 'column-set', 'test-element' ];

    foreach ( $tags as $tag ) {

        if ( ! isset( $allowedposttags[ $tag ] ) ) {
            $allowedposttags[ $tag ] = [
                'class' => true,
                'id' => true,
                'style' => true
            ];
        }

    }

    var_dump($allowedposttags);

}

After my var_dump, I see that in the allow tags, I now have:

'test-element' => 
  array (size=3)
    'class' => boolean true
    'id' => boolean true
    'style' => boolean true

But it's still being written to the page a <test -element="">.

  • 1
    Search for kses on our site. – fuxia Mar 23 '17 at 19:43
  • @toscho, I've added the custom element to kses and it's still not working. – Andy Mercer Mar 23 '17 at 19:54
0

It's not kses. The culprit is this:

force_balance_tags()

When I remove that, things work. I'm not sure why it's breaking things, but I'll look into the source later.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.