I’m building a WordPress theme and noticed that the 404 page template runs along with the corresponding templates for each page. Any idea why?

I used the following function to retrieve the URLs of each page. function template_debug($filename = null) { $url = home_url($_SERVER[‘REQUEST_URI’]); debug(“Called from: $filename using URL $url \n”); } Then I inspected the front page which triggered the 404 template along with the front-page template. The Network Monitor tab showed the error, which was an incorrect … Read more

How to add readable name and description to templates?

To add a readable title to a template, we can add the following to theme.json “customTemplates”: [ { “name”: “single-post-type-name”, “title”: “Single Post Type Name” }, … But as Will mentioned in the comments, it is not possible to add descriptions yet. There is an issue to track it here: https://github.com/WordPress/gutenberg/issues/44097

How to automatically set a Template Page Name next to a page in menu screen such as WooCommerce pages, front page, or posts page in wordpress?

Use the display_post_states hook: function custom_display_post_states( $states, $post ) { if ( ‘Services’ === $post->post_title ) { $post_states[‘custom-content’] = ‘Services Page’; } return $post_states; } add_filter( ‘display_post_states’, ‘custom_display_post_states’, 10, 2 ); or you can do by ID if ( 1 === $post->ID) { $post_states[‘custom-content’] = ‘Services Page’; } To check if page has template: function … Read more