Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backport-changelog/6.9/8063.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ https://github.com/WordPress/wordpress-develop/pull/8063

* https://github.com/WordPress/gutenberg/pull/67125
* https://github.com/WordPress/gutenberg/pull/71840
* https://github.com/WordPress/gutenberg/pull/72156
* https://github.com/WordPress/gutenberg/pull/71811
* https://github.com/WordPress/gutenberg/pull/72003
* https://github.com/WordPress/gutenberg/pull/72029
Expand Down
18 changes: 18 additions & 0 deletions lib/compat/wordpress-6.9/template-activate.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,11 @@ function gutenberg_set_active_template_theme( $changes, $request ) {
$changes->tax_input = array(
'wp_theme' => isset( $request['theme'] ) ? $request['theme'] : get_stylesheet(),
);
// All new templates saved will receive meta so we can distinguish between
// templates created the old way as edits and templates created the new way.
$changes->meta_input = array(
'is_inactive_by_default' => true,
);
return $changes;
}

Expand Down Expand Up @@ -477,6 +482,19 @@ function gutenberg_migrate_existing_templates() {
'terms' => get_stylesheet(),
),
),
// Only get templates that are not inactive by default.
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'is_inactive_by_default',
'compare' => 'NOT EXISTS',
),
array(
'key' => 'is_inactive_by_default',
'value' => false,
'compare' => '=',
),
),
);

$template_query = new WP_Query( $wp_query_args );
Expand Down
Loading