[wp-trac] [WordPress Trac] #54910: 5.9 Bug - Blank Home Page
WordPress Trac
noreply at wordpress.org
Sun Jan 30 12:22:28 UTC 2022
#54910: 5.9 Bug - Blank Home Page
--------------------------------------+------------------------------
Reporter: cantuaria | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version: 5.9
Severity: major | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+------------------------------
Comment (by costdev):
@manfcarlo Thanks for clarifying!
So:
- we check the cache. If it exists, we return the value, saving resources.
- we check that a `block-templates/index.html` or `templates/index.html`
exists and is readable.
- If none exists and is readable, we consider it a classic/hybrid theme.
- For the `index.html` files that exist, we scan the directory for files
that don't end in `.html` and are not `.htaccess` or `web.config`.
- As soon as a 'disallowed' file is found, we skip to the next
iteration/end the loop.
- Otherwise, if no 'disallowed' files are found, we consider it a
block theme.
Let's look at the case that opened this ticket: A `templates/index.html`
file exists in a classic theme.
With the checks outlined above, this will be identified as a block theme
''only'' if `index.html` exists/is readable and there are no other files
in the directory. The only time this is likely to occur is when the author
has just created the directory.
I think it's safe to have a false positive in this instance until the
theme author adds files to this directory, as it's likely a matter of
seconds until a `.php` file is added.
For classic themes that use templating engines, these tend to be within
`inc`, `assets` or other folders. I did a cursory scan for a common
templating engine substring in the wp.org themes directory and reviewed
the 40 themes that appeared in the results. None of them use the
`templates` directory. For other scans, a `templates` directory was used,
but didn't use `.html` files.
The one scenario I can think of is a newly initialized boilerplate where
the additional files may not be added until later in the theme's
development. However, I'd like to think that any boilerplate worth using
would have more than just an `index.html` file in its `templates` folder.
Given that, I think this implementation is safe enough in accuracy.
I've prepared a PR for this implementation, including unit tests, so that
we can review and compare the implementations for accuracy and
performance.
I'd appreciate everyone's opinions on this to see where we stand, as I'd
like to see our agreed changes be considered for 5.9.1 if possible.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54910#comment:45>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list