【问题标题】:javascript is not working in wordpressjavascript 在 wordpress 中不起作用
【发布时间】:2018-07-07 20:20:14
【问题描述】:

每当我在 WordPress 中添加 script 标签并发布/更新页面时,它都会导致我出现 404 page not found 错误。 简单的标签也会给出同样的错误。

<script></script>

【问题讨论】:

  • 您是在页面模板上还是在 WYSIWYG 编辑器中添加

标签: javascript wordpress http-status-code-404


【解决方案1】:

在您的 functions.php 文件中使用以下代码:

function add_scriptfilter( $string ) {
  global $allowedtags;
  $allowedtags['script'] = array( 'src' => array () );
  return $string;
}
add_filter( 'pre_kses', 'add_scriptfilter' );

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-07-17
    • 2017-09-29
    • 1970-01-01
    • 1970-01-01
    • 2020-12-04
    • 2021-09-15
    • 2021-08-07
    相关资源
    最近更新 更多