
welcart(ショップサイト)を運営していると
wordpress5.1(php7以上)にバージョンアップすると、
カートページにこのような警告文が出ることがあります。
/wp-includes/post-template.php on line 293.
(※数字は人によって違う)
wp-includesのpost-template.phpの「293行目がおかしいんちゃうの?」って言われています。
php言語にもバージョンがあって、それに適した記述をしないといけないんですね。
日本語も、ひと昔前の言葉が、今の言葉と全然違う意味になるような感じです。
(ひと昔前「やばい=マイナス言葉」、今「やばい=すごくいい」の意味もある、みたいな)
ってことでpost-template.phpファイルの293行目を直したいところなのですが、
この場合「連動しているその前後も含めて治す」必要があります。
該当箇所はこちら

// If post password required and it doesn't match the cookie.
if ( post_password_required( $post ) ) {
return get_the_password_form( $post );
}
if ( $page > count( $pages ) ) { // if the requested page doesn't exist
$page = count( $pages ); // give them the highest numbered page that DOES exist
}
5行上くらいの
// If post password~なんちゃら
295行目の
that DOES exist
}
までを以下に変更(コピペ可)
// If post password required and it doesn't match the cookie.
if ( post_password_required( $post ) ) {
return get_the_password_form( $post );
}
if ( ! empty( $pages ) ) {
if ( $page > count( $pages ) ) { // if the requested page doesn't exist
$page = count( $pages ); // give them the highest numbered page that DOES exist
}
} else {
$page = 0;
}
以上。
表示を確認してください。
消えていると思います。


