Skip to content

Commit

Permalink
Do not look for block variants, if not supporting block-templates (#4…
Browse files Browse the repository at this point in the history
…5362)

* Do not look for block varients, if not supporting block-templates

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>

Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
  • Loading branch information
2 people authored and Mamaduka committed Nov 10, 2022
1 parent 2406bb9 commit 78717bd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/block-library/src/template-part/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ function build_template_part_block_instance_variations() {
if ( wp_installing() ) {
return array();
}

if ( ! current_theme_supports( 'block-templates' ) && ! current_theme_supports( 'block-template-parts' ) ) {
return array();
}

$variations = array();
$template_parts = get_block_templates(
array(
Expand Down

0 comments on commit 78717bd

Please sign in to comment.