diff --git a/composer.lock b/composer.lock index ab01a5d9..20ae4a3c 100644 --- a/composer.lock +++ b/composer.lock @@ -1644,16 +1644,16 @@ }, { "name": "illuminate/collections", - "version": "v10.17.0", + "version": "v10.17.1", "source": { "type": "git", "url": "https://github.com/illuminate/collections.git", - "reference": "bc030c443fc43776070b96d66257c3b29153f30a" + "reference": "66ff5aab0dd10659aff0efe3ff101819db192dfe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/collections/zipball/bc030c443fc43776070b96d66257c3b29153f30a", - "reference": "bc030c443fc43776070b96d66257c3b29153f30a", + "url": "https://api.github.com/repos/illuminate/collections/zipball/66ff5aab0dd10659aff0efe3ff101819db192dfe", + "reference": "66ff5aab0dd10659aff0efe3ff101819db192dfe", "shasum": "" }, "require": { @@ -1695,11 +1695,11 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-07-27T15:19:34+00:00" + "time": "2023-08-02T14:57:32+00:00" }, { "name": "illuminate/conditionable", - "version": "v10.17.0", + "version": "v10.17.1", "source": { "type": "git", "url": "https://github.com/illuminate/conditionable.git", @@ -1745,7 +1745,7 @@ }, { "name": "illuminate/contracts", - "version": "v10.17.0", + "version": "v10.17.1", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", @@ -1793,7 +1793,7 @@ }, { "name": "illuminate/macroable", - "version": "v10.17.0", + "version": "v10.17.1", "source": { "type": "git", "url": "https://github.com/illuminate/macroable.git", @@ -1839,7 +1839,7 @@ }, { "name": "illuminate/support", - "version": "v10.17.0", + "version": "v10.17.1", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", diff --git a/src/Admin/Editor.php b/src/Admin/Editor.php index de38ad7f..48e9438c 100644 --- a/src/Admin/Editor.php +++ b/src/Admin/Editor.php @@ -50,7 +50,9 @@ public function validate_before_save_cb( $data, $post ) { $existing_post = get_post( $post['ID'] ); // Overwrite new/invalid query with previous working query, or empty - $data['post_content'] = $existing_post->post_content; + if ( $existing_post ) { + $data['post_content'] = $existing_post->post_content; + } AdminErrors::add_message( $e->getMessage() ); } @@ -286,7 +288,9 @@ public function make_excerpt_column_sortable_in_admin_cb( $columns ) { * @return array */ public function wp_editor_settings( $settings, $editor_id ) { - if ( 'content' === $editor_id && Document::TYPE_NAME === get_current_screen()->post_type ) { + $screen = get_current_screen(); + + if ( $screen && 'content' === $editor_id && Document::TYPE_NAME === $screen->post_type ) { $settings['tinymce'] = false; $settings['quicktags'] = false; $settings['media_buttons'] = false; diff --git a/src/Cache/Invalidation.php b/src/Cache/Invalidation.php index ce7ab059..29105948 100644 --- a/src/Cache/Invalidation.php +++ b/src/Cache/Invalidation.php @@ -128,7 +128,7 @@ public function init() { /** * Return a list of ignored meta keys * - * @return array|null + * @return array */ public static function get_ignored_meta_keys() { if ( null !== self::$ignored_meta_keys ) { @@ -542,6 +542,10 @@ public function on_transition_post_status_cb( $new_status, $old_status, WP_Post $post_type_object = get_post_type_object( $post->post_type ); + if ( ! $post_type_object instanceof \WP_Post_Type ) { + return; + } + // If the post type is not public and not publicly queryable // don't track it if ( false === $post_type_object->public && false === $post_type_object->publicly_queryable ) { @@ -578,8 +582,7 @@ public function on_transition_post_status_cb( $new_status, $old_status, WP_Post $action_type = 'CREATE'; } - $post_type_object = get_post_type_object( $post->post_type ); - $type_name = $post_type_object instanceof \WP_Post_Type ? strtolower( $post_type_object->graphql_single_name ) : $post_type_object; + $type_name = strtolower( $post_type_object->graphql_single_name ); // if we create a post // we need to purge lists of the type @@ -731,6 +734,10 @@ public function on_postmeta_change_cb( $meta_id, $post_id, $meta_key, $meta_valu $post_type_object = get_post_type_object( $post->post_type ); + if ( ! $post_type_object instanceof \WP_Post_Type ) { + return; + } + // If the post type is not public and not publicly queryable // don't track it if ( false === $post_type_object->public && false === $post_type_object->publicly_queryable ) {