Skip to content

Commit

Permalink
Site Editor: Set the <title> on the list page to be same as the CPT n…
Browse files Browse the repository at this point in the history
…ame (#36805)

* Site Editor: Set the <title> on the list page to be same as the CPT name

* Remove unused argument
  • Loading branch information
noisysocks committed Nov 28, 2021
1 parent 6954a42 commit 6a6cf52
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/full-site-editing/edit-site-page.php
Expand Up @@ -254,3 +254,18 @@ function register_site_editor_homepage_settings() {
);
}
add_action( 'init', 'register_site_editor_homepage_settings', 10 );

/**
* Sets the HTML <title> in the Site Editor list page to be the title of the CPT
* being edited, e.g. 'Templates'.
*/
function gutenberg_set_site_editor_list_page_title() {
global $title;
if ( gutenberg_is_edit_site_list_page() ) {
$post_type = get_post_type_object( $_GET['postType'] );
if ( $post_type ) {
$title = $post_type->labels->name;
}
}
}
add_action( 'load-appearance_page_gutenberg-edit-site', 'gutenberg_set_site_editor_list_page_title' );

0 comments on commit 6a6cf52

Please sign in to comment.