• I got the following PHP warning (on PHP 8.0.20), I have no idea what to do but my error_log file is getting extremely filled with this. Any clue please?

    “Attempt to read property “post_type” on null in <b>/home/kr/public_html/wp-includes/class-wp-query.php</b> on line 4338 on any URL ending with mysite.com/category/feed/

    (feed displays, however the error is at the top of the page)

    I’ve searched for that warning message on Google and I can say there’re thousands (no joke) of websites indexed with that warning message in the results.

    So, it seems that’s a very common problem.

    The warning appears only in /feed/ pages, the mentioned line in php file contains:
    return in_array( $post_obj->post_type, (array) $post_types, true );

    Wordpress version: 6.0.1

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    “mysite.com/category/feed/” is not normally a valid WP feed URL. Themes and plugins might possibly make it valid, but typically such a feed would only be for a specific category. You need an URL more like “mysite.com/category/example/feed/”.

    Without a specific category, get_queried_object() (line 4336) returns null, hence the error you see.

Viewing 1 replies (of 1 total)
  • The topic ‘Log Killer: Attempt to read property “post_type” on null in class-wp-query.php’ is closed to new replies.