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

Commit

Permalink
Allow saving post meta when the pattern name doesn't match the title …
Browse files Browse the repository at this point in the history
…(many themes) (#154)

* Allow saving post meta when the slug doesn't match the title
  • Loading branch information
kienstra committed May 5, 2023
1 parent 5cf5fc9 commit a674c70
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions wp-modules/editor/model.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ function save_pattern_to_file( WP_Post $post ) {
)
);

// Removes the post content, as it should be saved in the pattern .php file.
// Remove pattern data from the post, as it was written to the pattern .php file.
wp_update_post(
[
'ID' => $post->ID,
'post_title' => '',
'post_content' => '',
]
);
Expand Down Expand Up @@ -126,10 +127,9 @@ function save_metadata_to_pattern_file( $override, $post_id, $meta_key, $meta_va
get_pattern_defaults(),
$pattern ? $pattern : [],
[
'name' => $pattern_name,
'title' => $post->post_title,
],
[ $meta_key => $meta_value ]
'name' => $pattern_name,
$meta_key => $meta_value,
]
)
);
}
Expand Down

0 comments on commit a674c70

Please sign in to comment.