PHP 致命错误:未捕获的 ArgumentCountError:需要 3 个参数

问题描述 投票:0回答:1

WordPress版本:6.5.3 PHP版本:8.1 阿斯特拉主题版本:4.6.14 Nginx版本:1.26.0 当我将网站语言设置为中文并使用主题的搜索功能时,遇到错误,如下所示:

FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught ArgumentCountError: 3 arguments are required, 2 given in /var/www/html/wp-content/themes/astra/inc/core/common-functions.php:949
Stack trace:
#0 /var/www/html/wp-content/themes/astra/inc/core/common-functions.php(949): sprintf()
#1 /var/www/html/wp-content/themes/astra/inc/core/common-functions.php(1026): astra_get_taxonomy_banner_legacy_layout()
#2 /var/www/html/wp-includes/class-wp-hook.php(324): astra_archive_page_info()
#3 /var/www/html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#4 /var/www/html/wp-includes/plugin.php(517): WP_Hook->do_action()
#5 /var/www/html/wp-content/themes/astra/inc/core/theme-hooks.php(429): do_action()
#6 /var/www/html/wp-content/themes/astra/search.php(27): astra_archive_header()
#7 /var/www/html/wp-includes/template-loader.php(106): include('...')
#8 /var/www/html/wp-blog-header.php(19): require_once('...')
#9 /var/www/html/index.php(17): require('...')

当我将网站语言切换为英语时,主题的搜索功能再次正常工作。或者我尝试删除服务器目录中的文件

rm -rf /var/www/html/wp-content/languages/themes/*
现在搜索功能又可以正常工作了。我希望网站语言为中文并且搜索功能可以正常工作。有谁知道如何解决这个问题吗?

php wordpress wordpress-theme-astra
1个回答
0
投票
  1. 尝试清除缓存2)

  2. 更新PHP版本至8.3

  3. 如果以上两点都没有帮助。尝试在子主题中添加以下代码:

    add_filter( 'astra_theme_defaults', 'astra_theme_defaults_custom', 99, 1 ); 函数 astra_theme_defaults_custom($defaults) { $defaults['section-search-page-title-custom-title'] = '默认语言的搜索标题:'; 返回$默认值; }

© www.soinside.com 2019 - 2024. All rights reserved.