I'm working on a plugin that adds a custom WP rewrite rule using add_rewrite_rule()
and I'm loading a custom template for that rule using template_include
hook and passing the template path to that hook, so when the user visits that URL, the template is rendered successfully.
The template itself contains get_header()
on the top and get_footer()
at the bottom, and they are working as expected.
The problem comes when I install Full Site Editing themes like 'twenty twenty three', and I see this errors:
Deprecated: File Theme without header.php is deprecated since version 3.0.0 with no alternative available. Please include a header.php template in your theme. in /path/to/wp_installation/wp-includes/functions.php on line 5583
Deprecated: File Theme without footer.php is deprecated since version 3.0.0 with no alternative available. Please include a footer.php template in your theme. in /path/to/wp_installation/wp-includes/functions.php on line 5583
I know that the FSE themes are blocks, so how can I load the header block and the footer block? Also, I want to know how to check if the active theme is FSE theme or not.
Update 1
I tried to create a custom page template and used get_header()
and get_footer()
functions inside that template, and it raises the same errors.
Update 2
I found that this is related to this ticket on WordPress core trac.