小明的網誌

一個工程師的故事

By

把 wordpress 用到的 php 弄到 8.2.x, 紀錄遇到的問題及解決方法

問題1:

Too few arguments to function WP_Widget::__construct(), 0 passed in /usr/share/nginx/html/wp-includes/class-wp-widget-factory.php on line 62 and at least 2 expected

解法1:

ref: https://wordpress.stackexchange.com/questions/406260/wordpress-6-0-class-wp-widget-php-fatal-errors-in-php-8-1-6

修改 wp-includes/class-wp-widget-factory.php

$this->widgets[ $widget ] = new $widget( $widget, $widget );

問題2:

NOTICE: PHP message: PHP Warning:  Constant FS_CHMOD_DIR already defined in /usr/share/nginx/html/wp-config.php on line 134
NOTICE: PHP message: PHP Warning:  Constant FS_CHMOD_FILE already defined in /usr/share/nginx/html/wp-config.php on line 135

ref: https://wordpress.org/support/topic/constant-fs_chmod_dir-already-defined/

if ( ! defined( 'FS_CHMOD_FILE' ) ) {
    define('FS_CHMOD_FILE', 0644);
}
if ( ! defined( 'FS_CHMOD_DIR' ) ) {
    define('FS_CHMOD_DIR', 0755);
}

發表迴響

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料

Verified by MonsterInsights