The locate_block_template() function is the main function that resolves the list of possible block templates for any given (queried) page to the final template to use.
In this function, it sets the global variable $_wp_current_template_id. This can be used an identifier for the resolved template file. However, please be aware that since the variable starts with an underscore, this conventionally means that it is a global variable intended for internal WordPress core use only.
Related Posts:
- Correct way to make a custom block theme responsive
- Full site editing templates folder vs block-templates
- Adding copyright notice to page bottom in full site editing template
- Block to show posts from same category
- Full Site Editing, Block Theme, Gutenberg, Site Editor
- FSE Change Post Template to Something Other Than a List
- How do I access the current post object within a block theme template or pattern?
- Get the name of the template/*html file used
- Theme Activate Hook
- Can I create my own “Recent Posts” widget or customize the existing one?
- Do I actually need to link my theme’s style.css in the theme files
- Adding a div to wrap widget content after the widget title
- Customize WordPress>Error Page
- How to remove the Theme Customization Button from the dashboard and themes options page?
- How to make native video player full width?
- get_template_directory_uri() in child theme pointing at child theme
- What are the ADVANTAGES of ORIGINAL wordpress template structure?
- How to remove “prev, next, shortlink” from wp_head()?
- Theme file for all pages that are a child of a specific page
- Different ways to display title
- How to add a 2nd “featured image” to a post?
- What is the difference between WP: template_directory vs TEMPLATEPATH
- Strategy to get post meta for use outside the loop
- How to edit bbPress template files – WordPress + BuddyPress + bbPress? [closed]
- Authentication / login mechanism (non wp-admin)
- How to display wp_nav_menu() conditionally only when not on a 404 page?
- Suggestions for creative use of post format feature, or themes that use them well
- Retrieve the template directory URI via global or get_template_directory_uri() every time?
- Adding Content Areas to Custom Page Template
- Add class to before_widget for all widgets with a dropdown and a counter
- What is the best practice for customizing a plugin’s JavaScript/jQuery?
- How to add a section to the menus configuration, offering hard coded items?
- Add a #hash to the links in my custom menu
- Subdirectory install error
- How can i change menu link when page content empty?
- Override default cropping in WordPress [duplicate]
- Trouble with conditional tags
- How can I remove specific custom post meta from the “Custom Fields” fieldset?
- How to load different CSS in different Header?
- How can I add an incremental class identifier to my sidebar widgets?
- How to preset a sidebar widget with default content via script?
- How to use Iris color picker on front-end?
- Am I using get_posts wrong?
- First post of each category
- create blocks programmtically on theme activation
- Possible to add “Template” selector to posts?
- Set front page as static page [closed]
- Featured Image Size
- the_tags without hyperlinks?
- How to keep theme layout the same when admin gray bar is present?
- Writing Clean WooCommerce Styles
- Wrong path for theme assets
- one time popup after theme activation
- Create a theme by combining a parent and a child theme
- Custom header images won’t appear when set to random
- Modify Javascript Configuration Options for Theme Customizer Colour Picker
- Any tag pagination page (except the 1st page) loads index.php template instead of tag.php
- Adding LazyLoad and InfiniteScroll to WordPress Theme
- retrofiting old blog
- WordPress default theme css units
- How Can I Create a List of Values to Be Iterated Through via WordPress Customization API?
- Adding default pagination to wordpress loop
- how do you create an admin interface in plugin for your theme
- How to remove class attributes from custom menu markup?
- If I build a custom theme, will it update?
- Override parent theme’s include file from child theme
- Implement advanced search
- Implement content-nosidebar.php / content-leftsidebar.php
- How to change i18n/l10n of #reply-title? (Old title: Comment reply link not working)
- WordPress add options to theme not displaying
- What is the right way to set up a one-page portfolio theme? [closed]
- Where should I update_options in a theme?
- Is it possible to edit the styling of the admin panel from within a custom theme?
- When trying to override plugin’s function by theme, my filter executes two times, I want it to run only a single time
- Highest number of WordPress Custom Page Templates?
- Difficulty loading jQuery with wp_enqueue_script
- Users table association with users_metadata table appears broken
- Can’t login unless twentyfifteen theme is active
- multisite: global menu containing network site links?
- Injecting a custom sql query into a page/theme
- What are the Entry classes for?
- Using an if statement in the theme customizer page
- the_excerpt(); tag not working
- Installing WordPress locally
- Custom markup with wp_nav_menu based on pages
- How to edit my theme for full width?
- What VSCode extensions are there for working with block themes? [closed]
- What is the “correct” way to add hooks or similar PHP behavior to a blocktheme?
- Unable to check if image uploaded by wp_image_editor exists using file_exists function
- Force Balance Tags not working
- Storing the contents from txt file into The_Contents”
- How do you replace content generated by custom fields with custom blocks in Block Editor?
- How to add styles set by user in the customizer
- Use second time navigation.js in underscores [closed]
- Fetch wordpress video attachment with post ID
- Can I add multiple arrays within add_theme_support( ‘colors’ )?
- Template selection area is not visible on page editor sidebar in wordpress twentty sixteen default theme
- Issue with loading mobile specific custom single page layout in mobile
- Why does has_nav_menu return false when get_registered_nav_menus shows the opposite?
- Echo all category names, apart from one