• Webサイトのエラーログに以下が頻繁にあります。

    /wp-includes/class-wp-query.php on line 3903

    とあります。
    そこのソースは以下です。

    ===========

    public function is_category( $category = '' ) {
    		if ( ! $this->is_category ) {
    			return false;
    		}
    
    		if ( empty( $category ) ) {
    			return true;
    		}
    
    		$cat_obj = $this->get_queried_object();
    
    		$category = array_map( 'strval', (array) $category );
    
    【3903】		if ( in_array( (string) $cat_obj->term_id, $category, true ) ) {
    			return true;
    【3905】		} elseif ( in_array( $cat_obj->name, $category, true ) ) {
    			return true;
    【3907】		} elseif ( in_array( $cat_obj->slug, $category, true ) ) {
    			return true;
    		}
    
    		return false;
    	}

    ===========

    どのように修正すればいいでしょうか?
    教えてくださいませ。

    以下、エラーの全文です。
    ===========

    2022/07/04 **:**:** [error] 16635#0: *3604370 FastCGI sent in stderr: "PHP message: PHP Warning: Attempt to read property "term_id" on null in *****/wp-includes/class-wp-query.php on line 3903PHP message: PHP Warning: Attempt to read property "name" on null in *****/wp-includes/class-wp-query.php on line 3905PHP message: PHP Warning: Attempt to read property "slug" on null in *****/wp-includes/class-wp-query.php on line 3907PHP message: PHP Warning: Attempt to read property "term_id" on null in *****/wp-includes/class-wp-query.php on line 3903PHP message: PHP Warning: Attempt to read property "name" on null in *****/wp-includes/class-wp-query.php on line 3905PHP message: PHP Warning: Attempt to read property "slug" on null in *****/wp-includes/class-wp-query.php on line 3907PHP message: PHP Warning: Attempt to read property "term_id" on null in *****/wp-includes/class-wp-query.php on line 3903PHP message: PHP Warning: Attempt to read property "name" on null in *****/wp-includes/class-wp-query.php on line 3905PHP message: PHP Warning: Attempt to read property "slug" on null in *****/wp-includes/class-wp-query.php on line 3907", client: *******, server: ******, request: "GET / HTTP/1.1", host: "******"

    ===========

1件の返信を表示中 - 1 - 1件目 (全1件中)
  • それぞれ、使われている、WordPress、PHPなどは最新となっていますか。
    バージョンの不整合から似たメッセージをみたことがあります。

1件の返信を表示中 - 1 - 1件目 (全1件中)
  • トピック「class-wp-query.php のエラー」には新たに返信することはできません。