Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #174 from studiopress/fix/saves-with-invalid-post
Browse files Browse the repository at this point in the history
Make sure post_type exists before using it
  • Loading branch information
johnstonphilip committed May 25, 2023
2 parents c8e7bfb + 65b8ca8 commit 3bb7c28
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions wp-modules/editor/model.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ function save_pattern_to_file( WP_Post $post ) {
*/
function save_metadata_to_pattern_file( $override, $post_id, $meta_key, $meta_value ) {
$post = get_post( $post_id );

if ( ! isset( $post->post_type ) ) {
return $override;
}

if ( get_pattern_post_type() !== $post->post_type ) {
return $override;
}
Expand Down

0 comments on commit 3bb7c28

Please sign in to comment.