Since I don’t know where exactly the original error is produced, I can’t show a way to reproduce the origin. The fatal error only occurs when the latest entries are displayed in the overview page of all blogs in a multiblog, in a language like /en/ or /de/.
The WPML plugin supports the languages ??but their support does not understand the problem and I understand this because the fatal PHP error is triggered in the WordPress code. So you would have to look for why get_term() returns NULL. I suspect that some WPML tables are incorrect because most blogs are displayed but some are not. And it fits that the WPML was not set up correctly in the blogs in question by the respective bloggers.
However, subsequent installations do not change the tables, as I have found, and some tables look different than those from other blogs. What should the structure of proper WPML tables look like and what are the default values?
In get_term() is written,
if ( is_wp_error( $_term ) ) {
return $_term;
} elseif ( ! $_term ) {
return null;
}
So what is the reason, why $_term is NULL or FALSE and that’s why it returned NULL?
But as you can see, get_term() can return a NULL instead of an object. That’s why it’s not necessary to recreate this for the fatal error triggered by the WordPress code. PHP clearly states that you cannot assign an object property to a Boolean. As a result,
$term->object_id = (int) $term_data->object_id;
works simply not. There must be at least the check if(is_object($term)) in this class.
https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-term-query.php#L1134C10-L1134C10
Like this in row 1133:
$term = get_term( $term_data->term_id );
if ( is_object($term) && property_exists( $term_data, 'object_id' ) ) {
$term->object_id = (int) $term_data->object_id;
}
And it works.
The original error somewhere in the WPML tables is still pending, but the blog is running again for now.