一、基本情况
PHP使用了8.5以后,今天打开某个页面,出现Fatal error: Uncaught ArgumentCountError: Too few arguments to function get_day_link()1 passed in /www/wwwroot/XXXX/wp-content/themes/blogus/inc/ansar/breadcrumb-trail/breadcrumbs.php on line 820 and exactly 3 expected in /www/wwwroot/XXXX/wp-includes/link-template.php:623 Stack trace: #0 /www/wwwroot/XXXX/wp-content/themes/blogus/inc/ansar/breadcrumb-trail/breadcrumbs.php(820): get_day_link() #等错误、
二、解决办法
打开 wp-content/themes/blogus/inc/ansar/breadcrumb-trail/breadcrumbs.php,找到第 820 行附近,将类似 get_day_link( $something ) 的调用,改为传入三个完整的日期参数。
把820行
// Add the day item.
if ( is_paged() )
$this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_day_link( get_the_time( 'Y' ) ), get_the_time( 'm' ), get_the_time( 'd' ) ), $day );
修改为,也就是把 get_day_link( 后面的 ) 移到 get_the_time( 'd' ) 之后,让三个参数都进 get_day_link(),再整体交给 esc_url()。
// Add the day item.
if ( is_paged() )
$this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_day_link( get_the_time( 'Y' ), get_the_time( 'm' ), get_the_time( 'd' ) ) ), $day );