Opened 14 years ago
Closed 14 years ago
#14874 closed enhancement (wontfix)
Add New Filter to validate_current_theme
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.1 |
Component: | Themes | Keywords: | theme has-patch |
Focuses: | Cc: |
Description
I am finding that as I build more complicated themes, I need to check for prerequisites (certain plugins, php5, whatever). The current function has no means of catching the theme activation and checking.
Attached is a patch that add a new validate_current_theme_requirements to the function. The patch also modifies the wp-admin/themes.php to check for a WP_Error result and output the provided error.
Attachments (1)
Change History (6)
#1
@
14 years ago
Interesting idea. I wonder if changing the return value for validate_current_theme can cause problems, however.
#3
@
14 years ago
It is an interesting issue. My case would be that returning a WP_Error object and delivering the results in the theme.php file is more WordPress-like in it current incarnation than a generic true/false.
If it is felt that there might be enough plugins that break with this change, but the patch is desirable. We are then left with the "ugly" need to deprecate another function in favor of a new function.
I would suggest that the output of the current function is so useless as to be not used by many (if any) plugins/themes out there. It is kind of an obscure corner of WordPress.
I see that 1) there haven't been any changes in this part of the code since 2008 and 2) this change would allow better documentation for the case of a missing Default theme. (##11282, #14175)
#4
@
14 years ago
- Cc westi added
Adding a filter here is a bad idea.
Your adding the check in completely the wrong place.
We could/should add an activation hook themes could use.
However, a theme should gracefully degrade and work in all scenarios.
If plugins are missing then the theme should add an admin notice and let the user know without causing any php errors / WSOD on the frontend.
Diff to wp-includes/theme.php and wp-admin/theme.php