Minor bug fix
-
My log is filled with the message: PHP Warning: Attempt to read property “label” on null in
/wp-content/plugins/betterdocs/includes/Editors/Elementor/DocsArchive.php on line 47The error occurs because:
get_post_type_object('docs')is called on line 45- If the ‘docs’ post type hasn’t been registered yet (timing issue during WordPress initialization), this function returns
null - Line 47 tries to access without checking if the object exists first
$post_type_object->label - PHP 8.0+ throws a warning when you try to access a property on
null
Maybe it’s worth adding a null check?
if ( $post_type_object !== null ) {
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.