From e8a676308226b7a225e1d86c47b5868d38881660 Mon Sep 17 00:00:00 2001 From: Linkon Miyan Date: Mon, 25 Mar 2024 20:16:19 +0600 Subject: [PATCH] fixed fatal error --- includes/Extensions/Table_of_Content.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/includes/Extensions/Table_of_Content.php b/includes/Extensions/Table_of_Content.php index 289433864..e4e96afba 100755 --- a/includes/Extensions/Table_of_Content.php +++ b/includes/Extensions/Table_of_Content.php @@ -93,10 +93,12 @@ public function register_controls($element) if ( ! empty( $supported_posts ) ) { foreach ( $supported_posts as $post_type ) { - if ( ! in_array( $post_type, [ 'post', 'page' ] ) ) { - $post_type_labels = get_post_type_labels( get_post_type_object( $post_type ) ); - $plural_name = $post_type_labels->name; - $display_on[ $post_type ] = sprintf( __( 'All %s', 'essential-addons-for-elementor-lite' ), $plural_name ); + $post_obj = get_post_type_object( $post_type ); + + if ( ! in_array( $post_type, [ 'post', 'page' ] ) && is_a( $post_obj, 'WP_Post_Type' ) && $post_obj->labels ) { + $post_type_labels = get_post_type_labels( $post_obj ); + $plural_name = $post_type_labels->name; + $display_on[ $post_type ] = sprintf( __( 'All %s', 'essential-addons-for-elementor-lite' ), $plural_name ); } } }