From d4f368763e9be4e053ab51b7bb6f91542d1b8b28 Mon Sep 17 00:00:00 2001 From: LyNguyen Date: Fri, 2 Feb 2024 18:52:09 +0700 Subject: [PATCH] Fix null warning notice --- src/PostTypeRegister.php | 4 ++++ src/TaxonomyRegister.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/PostTypeRegister.php b/src/PostTypeRegister.php index aac0cda..2f8522d 100644 --- a/src/PostTypeRegister.php +++ b/src/PostTypeRegister.php @@ -85,6 +85,10 @@ public function get_post_types() { foreach ( $posts as $post ) { $settings = $this->get_post_type_settings( $post ); + if ( empty( $settings ) ) { + continue; + } + $post_types[ $settings['slug'] ] = $settings; } diff --git a/src/TaxonomyRegister.php b/src/TaxonomyRegister.php index 45e3988..81977e0 100644 --- a/src/TaxonomyRegister.php +++ b/src/TaxonomyRegister.php @@ -114,6 +114,10 @@ public function get_taxonomies() { foreach ( $posts as $post ) { $data = $this->get_taxonomy_data( $post ); + if ( empty( $data ) ) { + continue; + } + $taxonomies[ $data['slug'] ] = $data; }