Skip to content

Commit

Permalink
Tests: Enable post type UI for templates and template parts (#38486)
Browse files Browse the repository at this point in the history
* Tests: Enable post type UI for templates and template parts
* Only enable UI for block themes
  • Loading branch information
Mamaduka committed Feb 3, 2022
1 parent 09e4930 commit 4aa3187
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions packages/e2e-tests/mu-plugins/enable-templates-ui.php
@@ -0,0 +1,24 @@
<?php
/**
* Plugin Name: Gutenberg Test Plugin, Enable Templates UI
* Plugin URI: https://github.com/WordPress/gutenberg
* Author: Gutenberg Team
*
* @package gutenberg-test-enable-templates-ui
*/

/**
* Enable Templates & Template Parts post type UI during e2e testing.
*/
add_filter(
'register_post_type_args',
static function( $args, $name ) {
if ( in_array( $name, array( 'wp_template', 'wp_template_part' ), true ) ) {
$args['show_ui'] = wp_is_block_theme();
}

return $args;
},
20,
2
);

0 comments on commit 4aa3187

Please sign in to comment.