[wp-trac] [WordPress Trac] #57928: Prevent loading wp-content/themes/functions.php when 'stylesheet' option is empty

WordPress Trac noreply at wordpress.org
Wed Mar 15 13:39:33 UTC 2023


#57928: Prevent loading wp-content/themes/functions.php when 'stylesheet' option is
empty
-----------------------------+------------------------------
 Reporter:  danielbachhuber  |       Owner:  (none)
     Type:  enhancement      |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Bootstrap/Load   |     Version:
 Severity:  normal           |  Resolution:
 Keywords:  dev-feedback     |     Focuses:
-----------------------------+------------------------------

Comment (by SergeyBiryukov):

 Replying to [ticket:57928 danielbachhuber]:
 > What's the best way to prevent loading `wp-
 content/themes/functions.php`? Maybe `wp_get_active_and_valid_themes()`
 should return an empty array if 'template' and 'stylesheet' are empty?

 That makes sense to me at a glance.

 However, it is worth noting that `wp-content/themes/functions.php`
 [source:tags/6.1.1/src/wp-settings.php?marks=584#L581 would only be loaded
 if it exists]. Unless I'm missing something, that file is not supposed to
 exist on a regular installation, so this seems like an edge case to me.

 The linked issue includes this step:
 > Create a `functions.php` file with a syntax error or an undefined
 function like `<?php genesis_register_sidebar();` and place under `/wp-
 content/themes/`

 Is there a real-world use case where that file would exist?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57928#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list