#54381 closed enhancement (fixed)
Add filter to validate_theme_requirements
| Reported by: | | Owned by: | |
|---|---|---|---|
| Milestone: | 6.9 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Themes | Keywords: | has-patch has-unit-tests |
| Focuses: | Cc: |
Description
There may be the need to add extra requirements for a theme to validate that site administrators may want to add. The validate_theme_requirements function looks keen for this, but there are currently no hooks in the function.
An example use case: A particular site on a multisite should never have a theme changed via the UI (a mission-critical site). The multisite, generally, has various themes network activated. Such a filter could allow a site administrator to check the blog ID and return a WP_Error if the blog ID is in a "theme_change_disallowed" array.
Proposing a validate_theme_requirement filter that hooks at the end of the current function to allow additional validation requirements. Intentionally not filtering the current failing conditions (incompatible WP or PHP) to prevent poor implementation of the filter to lead to a PHP/WP version-related fatal.
Attachments (1)
Change History (13)
This ticket was mentioned in PR #1812 on WordPress/wordpress-develop by kraftbj.
4 years ago #1
- Keywords has-patch has-unit-tests added
#2
@
4 months ago
Enhancement: Add filter hook to allow customization of validate_theme_requirements() results.
#3
@
4 months ago
- Milestone changed from Awaiting Review to 6.9
- Owner set to kraftbj
- Status changed from new to accepted
Refreshed the patch to see if we can land in 6.9!
This ticket was mentioned in Slack in #core by welcher. View the logs.
8 weeks ago
This ticket was mentioned in Slack in #core by wildworks. View the logs.
5 weeks ago
#6
@
5 weeks ago
This ticket was featured on today's 6.9 Bug Scrub.
Maybe @jorbin will take a look at this ticket if he has time.
#7
@
5 weeks ago
It really seems like we should add the same filtering capabilities in validate_plugin_requirements(), at the same time, which seems to have the same limitations.
This ticket was mentioned in PR #10361 on WordPress/wordpress-develop by @joedolson.
5 weeks ago #8
For API consistency, add a filter to validate_plugin_requirement comparable to validate_theme_requirement
Not sure where tests for this might live, if we need them.
Trac ticket: https://core.trac.wordpress.org/ticket/54381
@joedolson commented on PR #10361:
5 weeks ago #9
@jorbin commented on PR #10361:
5 weeks ago #10
@joedolson good catch. I agree.
#12
@
4 days ago
The miscellaneous developer-focused changes developer note mentioned the two new hooks introduced in [60995] but did not cover their usage in depth: https://make.wordpress.org/core/2025/11/17/miscellaneous-developer-focused-changes-in-6-9/.
Adds a filter,
validate_theme_requirements, to allow for additional theme validation requirements.Trac ticket: https://core.trac.wordpress.org/ticket/54381