【问题标题】:How do you extend Themosis helpers.php functions?你如何扩展 Themosis helpers.php 函数?
【发布时间】:2019-08-18 22:19:33
【问题描述】:

如何扩展 Themosis Core -> helpers.php 文件中的功能?

我想覆盖以下内容:

if (! function_exists('csrf_field')) {
    /**
     * Generate a CSRF token form field.
     *
     * @return HtmlString
     */
    function csrf_field()
    {
        return new HtmlString('<input type="hidden" name="_token" value="'.csrf_token().'">');
    }
}

如果 varnish 被定义为启用,它会更改为使用边缘端包含将令牌放在页面上?

但不知道我可以在应用程序结构中的哪个位置覆盖这个函数。

谢谢

【问题讨论】:

    标签: php wordpress woocommerce csrf varnish


    【解决方案1】:

    只需在你的functions.php中添加一个同名的函数

    function csrf_field(){
        return new HtmlString('<input type="hidden" name="_token" value="'.csrf_token().'">');
    }
    

    并进行更改。

    【讨论】:

      猜你喜欢
      • 2010-09-12
      • 1970-01-01
      • 2011-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-07
      • 1970-01-01
      相关资源
      最近更新 更多