dongpaozhi5734 2019-06-23 17:37
浏览 76
已采纳

根据WP编码标准清理和清理php代码

I have few lines of code which i need to clean up as per WP coding standard using the functions like esc_html, wp_kses() etc (https://developer.wordpress.org/reference/functions/wp_kses/). That code generates a printing button on the post detail page. The problem is i can't figure out the correct way to use wp_kses function so as to show the button on the page. Could anyone help me here? I am a beginner for php. Thanks in advance!

Code on the file

<!-- printer friednly link  -->
    <?php if(function_exists('pf_show_link')){echo pf_show_link();} ?>

Code i am trying to add which is not outputting any button

<!-- printer friednly link  -->
    <?php
    if ( function_exists( 'pf_show_link' ) ) {
        $allowed_tags = array(
            'strong' => array(),
            'a'      => array(
                'href'  => array(),
                'title' => array(),
            ),
        );
        echo wp_kses( $allowed_tags );
    }
    ?>

the button which renders from the code

  • 写回答

1条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 Python不使用Selenium怎么实现网页输入和点击
      • ¥50 vue百度地图导致浏览器崩溃
      • ¥15 请问这段C语言代码应该如何修改呢
      • ¥20 Latex 转入带数式的曲线图后数式部分报错
      • ¥15 Arcgis基于一幅栅格提取另一幅栅格单元值
      • ¥15 Verilog数据产生器代码疑点
      • ¥15 电脑部分网页无法访问是为什么?
      • ¥15 如何在vscode导出pdf失败了,拓展也安装了?
      • ¥15 使用python-kivy如何点击按钮选择手机相册中的图片?
      • ¥15 Matlab图像生成后如何对于打开exe文件