Skip to main content

Bug or intentional?

I'm attempting to add a feed post programmatically. The text of the post has a link with a target attribute. The target attribute is getting stripped. I found in the FeedsHelper mdToHtml function, the call to wp_kses includes an array of allowed html tags. The entry for links looks like this:

            'a'          => array(
                'href'    => true,
                'title'   => true,
                'rel'     => true,
                '_target' => true,
            ),

Is the _ before target intentional or a typo/bug in the code? Should target attributes be allowed when creating posts programmatically?

Thanks!

Tawsif Ahmed Riyad

ChangeΒ '_target' => true,Β toΒ 'target' => true,Β in the array. Can you tell me with this, does it work? It should work.

Thomas Oates

Tawsif Ahmed RiyadΒ Yep, it does work. Is that a change that will made to the official code? Thanks!!

Tawsif Ahmed Riyad

Thomas Oates, yeah, a change will be made. As it was a typo, actually.

Thomas Oates

Tawsif Ahmed RiyadΒ Awesome...thanks!

Tawsif Ahmed Riyad

Thomas Oates, you are most welcome.

Shahjahan Jewel

Yes, it will be target instead of _target. Will be fixed in the next version

Shahjahan Jewel

Thomas OatesΒ yes. Need to remove _