Skip to content

Commit

Permalink
Remove filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka authored and noisysocks committed Dec 6, 2021
1 parent 30fb4ed commit 1dcf599
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 59 deletions.
30 changes: 0 additions & 30 deletions lib/compat/wordpress-5.9/template-parts.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,36 +100,6 @@ function gutenberg_register_wp_template_part_area_taxonomy() {
}
add_action( 'init', 'gutenberg_register_wp_template_part_area_taxonomy' );

/**
* Fixes the label of the 'wp_template_part' admin menu entry.
*/
function gutenberg_fix_template_part_admin_menu_entry() {
if ( ! gutenberg_supports_block_templates() ) {
return;
}

global $submenu;
if ( ! isset( $submenu['themes.php'] ) ) {
return;
}
$post_type = get_post_type_object( 'wp_template_part' );
if ( ! $post_type ) {
return;
}
foreach ( $submenu['themes.php'] as $key => $submenu_entry ) {
if ( $post_type->labels->all_items === $submenu['themes.php'][ $key ][0] ) {
$submenu['themes.php'][ $key ][0] = $post_type->labels->menu_name; // phpcs:ignore WordPress.WP.GlobalVariablesOverride
break;
}
}
}
add_action( 'admin_menu', 'gutenberg_fix_template_part_admin_menu_entry' );

// Customize the `wp_template` admin list.
add_filter( 'manage_wp_template_part_posts_columns', 'gutenberg_templates_lists_custom_columns' );
add_action( 'manage_wp_template_part_posts_custom_column', 'gutenberg_render_templates_lists_custom_column', 10, 2 );
add_filter( 'views_edit-wp_template_part', 'gutenberg_filter_templates_edit_views' );

/**
* Sets a custom slug when creating auto-draft template parts.
* This is only needed for auto-drafts created by the regular WP editor.
Expand Down
29 changes: 0 additions & 29 deletions lib/compat/wordpress-5.9/templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,35 +127,6 @@ function gutenberg_grant_template_caps( array $allcaps ) {
}
add_filter( 'user_has_cap', 'gutenberg_grant_template_caps' );

/**
* Fixes the label of the 'wp_template' admin menu entry.
*/
function gutenberg_fix_template_admin_menu_entry() {
if ( ! gutenberg_supports_block_templates() ) {
return;
}
global $submenu;
if ( ! isset( $submenu['themes.php'] ) ) {
return;
}
$post_type = get_post_type_object( 'wp_template' );
if ( ! $post_type ) {
return;
}
foreach ( $submenu['themes.php'] as $key => $submenu_entry ) {
if ( $post_type->labels->all_items === $submenu['themes.php'][ $key ][0] ) {
$submenu['themes.php'][ $key ][0] = $post_type->labels->menu_name; // phpcs:ignore WordPress.WP.GlobalVariablesOverride
break;
}
}
}
add_action( 'admin_menu', 'gutenberg_fix_template_admin_menu_entry' );

// Customize the `wp_template` admin list.
add_filter( 'manage_wp_template_posts_columns', 'gutenberg_templates_lists_custom_columns' );
add_action( 'manage_wp_template_posts_custom_column', 'gutenberg_render_templates_lists_custom_column', 10, 2 );
add_filter( 'views_edit-wp_template', 'gutenberg_filter_templates_edit_views' );

/**
* Sets a custom slug when creating auto-draft templates.
* This is only needed for auto-drafts created by the regular WP editor.
Expand Down

0 comments on commit 1dcf599

Please sign in to comment.