Skip to content
Prev Previous commit
Next Next commit
Move files and add explanation
  • Loading branch information
talldan committed Dec 1, 2021
commit d81854126a4bbb12eedbc8baac336c608b28f790
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@
/**
* Block template part functions.
*
* This is a temporary compatibility fix for WordPress 5.8.x, which is missing
* some features for template parts that are present in 5.9.
*
* Once 5.9 is the minimum supported WordPress version for the Gutenberg
* plugin, this shim can be removed.
*
* @package gutenberg
*/

/**
* Registers block editor 'wp_template_part' post type.
*/
function gutenberg_register_template_part_post_type() {
if ( ! gutenberg_supports_block_templates() ) {
if ( post_type_exists( 'wp_template_part' ) ) {
return;
}

// If the post type has already been registered (by WordPress core), skip
// registration.
if ( post_type_exists( 'wp_template_part' ) ) {
if ( ! gutenberg_supports_block_templates() ) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@
/**
* Block template functions.
*
* This is a temporary compatibility fix for WordPress 5.8.x, which is missing
* some features for templates that are present in 5.9.
*
* Once 5.9 is the minimum supported WordPress version for the Gutenberg
* plugin, this shim can be removed.
*
* @package gutenberg
*/

/**
* Registers block editor 'wp_template' post type.
*/
function gutenberg_register_template_post_type() {
if ( ! gutenberg_supports_block_templates() ) {
if ( post_type_exists( 'wp_template' ) ) {
return;
}

// If the post type has already been registered (by WordPress core), skip
// registration.
if ( post_type_exists( 'wp_template' ) ) {
if ( ! gutenberg_supports_block_templates() ) {
return;
}

Expand Down