Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#54381 new enhancement

Add filter to validate_theme_requirements

Reported by: kraftbj's profile kraftbj Owned by:
Milestone: Awaiting Review 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.

Change History (1)

This ticket was mentioned in PR #1812 on WordPress/wordpress-develop by kraftbj.


2 years ago
#1

  • Keywords has-patch has-unit-tests added

Adds a filter, validate_theme_requirements, to allow for additional theme validation requirements.

Trac ticket: https://core.trac.wordpress.org/ticket/54381

Note: See TracTickets for help on using tickets.