1,functions.php
Warning: Use of undefined constant git_reset_password_message – assumed ‘git_reset_password_message’ (this will throw an Error in a future version of PHP) in /Git-finally/functions.php on line 2351
/Git-finally/functions.php
2351行
add_filter('retrieve_password_message', git_reset_password_message, null, 2); 改为 add_filter('retrieve_password_message', 'git_reset_password_message', null, 2);
2,functions.php
Warning: Use of undefined constant target – assumed ‘target’ (this will throw an Error in a future version of PHP) in /Git-finally/functions.php on line 2303
2304行
target => '_blank' 改为 'target' => '_blank'
3,functions.php
wordpress升级失败,出现错误
cURL error 60: SSL certificate problem: unable to get local issuer certificate
若证书问题持续,可通过添加代码临时关闭 SSL 验证:
在 functions.php 中
添加
add_filter('https_ssl_verify', '__return_false');
4,functions.php
Warning: Undefined variable $post in /Git-finally/functions.php on line 180
Warning: Attempt to read property “ID” on null in /Git-finally/functions.php on line 180
$git_remote_pic = get_post_meta($post->ID, 'git_remote_pic', true); 修改为 global $post; //申明变量 $post_id = $post?->ID; $git_remote_pic = get_post_meta($post_id, 'git_remote_pic', true); //添加?空值安全操作符
或者
global $post; //申明变量 $git_remote_pic = get_post_meta($post?->ID, 'git_remote_pic', true); //添加?空值安全操作符
Fatal error: Uncaught Error: Call to undefined function create_function() in /Git-finally/functions.php:94 Stack trace
add_filter( 'max_srcset_image_width', create_function( '', 'return 1;' ) ); 改为 add_filter( 'max_srcset_image_width', 'max_image_width_return' ); function max_image_width_return() { return 1; }
Fatal error: Uncaught Error: Undefined constant “git_esc_callback” in /Git-finally/functions.php:1145 Stack trace:
return preg_replace_callback($regex, git_esc_callback, $content); 修改为 return preg_replace_callback($regex, 'git_esc_callback', $content);
5,缩微图不显示
Warning:Undefined array key 0 in /Git-finally/function.php 819行
$post_thumbnail_src = $matches[1][0]; //获取该图片 src 修改为 $thumbnailcheck = $matches [1] [0] ?? ''; $post_thumbnail_src = $thumbnailcheck; //获取该图片 src
6,Warning: Undefined variable $post_id in /Git-finally/functions.php on line 1459
function baidu_check($url) { global $wpdb; 改为 function baidu_check($url) { global $wpdb,$post_id;
Warning: Undefined variable $output in functions.php on line 1017
function fa_get_wpsmiliestrans() { global $wpsmiliestrans; 改为 function fa_get_wpsmiliestrans() { global $wpsmiliestrans,$output;
7,commons.php
date_default_timezone_set(PRC); 改为 date_default_timezone_set('PRC'); global $comment_ids; $comment_ids = array(); 改为 global $comment_i,$comment_ids; $comment_ids = array();
8,inc/theme-widgets.php
Warning: Undefined array key “title” in /Git-finally/inc/theme-widgets.php on line 948
function widget($args, $instance) { extract($args); $title = apply_filters('widget_name', $instance['title']); 修改为 function widget($args, $instance) { extract($args); if (isset ($instance['title'])) {$title = apply_filters('widget_name', $instance['title']);}
9,inc/theme-options.php
Warning: Undefined array key “page” in /Git-finally/inc/theme-options.php on line 1487
if (isset($_GET['page'] == basename(__FILE__))) { 改为 if (isset($_GET['page']) && $_GET['page'] == basename(__FILE__)) {
Warning: Undefined array key “action” in /Git-finally/inc/theme-options.php on line 1488
if ('update' == $_REQUEST['action']) { 改为 if (isset($_REQUEST['action']) && 'update' == $_REQUEST['action']) {
Warning: Undefined array key “action” in /Git-finally/inc/theme-options.php on line 1499
} else if( 'reset' == $_REQUEST['action'] ) { 改为 } else if( isset($_REQUEST['action']) && 'reset' == $_REQUEST['action'] ) {
Warning: Undefined array key “update” in /Git-finally/inc/theme-options.php on line 1515
Warning: Undefined array key “reset” in /Git-finally/inc/theme-options.php on line 1516
if ($_REQUEST['update']) echo '<div class="updated"><p><strong>设置已保存。</strong></p></div>'; 改为 if (isset($_REQUEST['update'])) echo '<div class="updated"><p><strong>设置已保存。</strong></p></div>'; if ($_REQUEST['reset']) echo '<div class="updated"><p><strong>设置已重置。</strong></p></div>'; 改为 if (isset($_REQUEST['reset'])) echo '<div class="updated"><p><strong>设置已重置。</strong></p></div>';