admin管理员组

文章数量:1122846

WP Rewrite Rules, Custom Templates, and Full Site Editing Themes Compatibility

I'm developing a WordPress plugin that adds a custom rewrite rule using add_rewrite_rule() and loads a custom template for that rule using the template_include hook. The template includes get_header() at the top and get_footer() at the bottom, which work as expected with traditional themes.

The Problem

When using Full Site Editing (FSE) themes like "Twenty Twenty-Three", I encounter the following deprecation 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

Questions

  1. How can I load the header and footer blocks in FSE themes?
  2. Is there a way to check if the active theme is an FSE theme?

Updates

Update 1

Creating a custom page template with get_header() and get_footer() functions still raises the same errors.

Update 2

This issue appears to be related to this ticket on WordPress core trac.

Any insights or solutions would be greatly appreciated!

本文标签: plugin developmentCustom WP Rewrite Rules and Templates Incompatible with Full Site Editing Themes