新的網頁空間需要調整:

  • PHP 7.2 切換到 PHP 7.4
  • PHP 7.4 Default option 也需要跟著調,只要查看 Wordpress 的網站狀態的建議就知道哪些模組需要去打勾
  • PHP錯誤訊息: PHP Deprecated: Function create_function() is deprecated in /home/XXXXX/public_html/wp-content/themes/YYYYY/cherry-framework/setup.php on line 14,這個錯誤將導致後台在外觀的設定錯亂,就算是程式修正也無法復原。該程式的 create_function... 需換成下列程式,至於如何修復後台外觀自訂,將在下一點說明
return function () {         
    global $chery_core_version;
    
    $path = trailingslashit( dirname( __FILE__ ) ) . 'cherry-core.php';
    
    $data = get_file_data( $path, array(
        'version' => 'Version'
    ) );
    
    if ( isset( $data['version'] ) ) {                 
         $version = $data['version'];
    }         
    
    $old_versions = null;
    
    if ( null !== $chery_core_version ) {                 
         $old_versions = array_keys( $chery_core_version );         
    }
    
    if ( is_array( $old_versions ) && isset( $old_versions[0] ) ) {                 
         $compare = version_compare( $old_versions[0], $version,'<' );
         
         if ( $compare ) {                         
             $chery_core_version = array();
             $chery_core_version[ $version ] = $path;                 
         }         
    } else {
         $chery_core_version = array();
         $chery_core_version[ $version ] = $path;         
} }; 
  • 修復後台Theme的外觀自訂:
  1. switch to another default theme (I used twenty nineteen) and re-assign a primary menu.
  2. jump into the db and search in the options for 'theme_mods_' there should be one for each theme in there. One is your broken theme and you should fine the other one twentynineteen.
  3. copy the options value from twenty nineteen and set it for the value for your broken theme. Then switch it back and assign the primary menu again.

原理大概就是去複製正常運作過的 Theme 所儲存的資料,然後再回來重新設定一次 Theme 的自訂,當然,這些操作的前提是,程式需要先修復,不然連其他 Theme 的資料都被毀了!

  • PHP 7.4 錯誤訊息: Trying to access array offset on value of type null... 導致 Wordpress 5.3.8 的媒體上傳功能 (file.php) 故障,這個問題有 PHP 7.4 的修正更新,但是虛擬主機就沒這個彈性了,而且: Previous versions of PHP may have been less strict on such mistakes and silently swallowed the error / notice while 7.4 does not do this anymore. 所以這是 PHP 7.4 變得比較嚴謹所導致,不該讓 PHP 走回頭路,最好能改網站程式,這樣只好期待 Wordpress 更新了! 暫時降版到 PHP 7.3 了

 

Add comment


Security code
Refresh

Go to top