wp kses - Why wp_kses() not working for rel, target of link in Wordpress

I am using below code for wp_kses(). But it's ignoring rel & target in the result. I want to show rel="nof

I am using below code for wp_kses(). But it's ignoring rel & target in the result. I want to show rel="nofolow" target="_blank" in my result (link).

$link = "Here is my link: <a href="my-link" rel="nofollow" target="_blank">Link Text</a>" 

$allowed_tags= array(
                        'br' => array(),
                        'p' => array(),
                        'a'  => array(
                                'href'     => true,
                                'rel'      => true,
                                'target'   => true,                             
                            ),
                );


$result = wp_kses( $link, $allowed_tags );

Output result: Here is my link: <a href="my-link">Link Text</a>

Expected result: Here is my link: <a href="my-link" rel="nofollow" target="_blank">Link Text</a>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744969102a4603859.html

相关推荐

  • wp kses - Why wp_kses() not working for rel, target of link in Wordpress

    I am using below code for wp_kses(). But it's ignoring rel & target in the result. I want to show rel="nof

    1天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信