[wp-trac] [WordPress Trac] #38650: Provide some guidance on what conditionals can/should be used in default-filters.php

WordPress Trac noreply at wordpress.org
Sun Aug 25 05:02:44 UTC 2024


#38650: Provide some guidance on what conditionals can/should be used in default-
filters.php
----------------------------+---------------------
 Reporter:  helen           |       Owner:  (none)
     Type:  enhancement     |      Status:  new
 Priority:  low             |   Milestone:  6.7
Component:  Bootstrap/Load  |     Version:
 Severity:  minor           |  Resolution:
 Keywords:  has-patch       |     Focuses:  docs
----------------------------+---------------------

Comment (by utech1):

 To make things clearer for developers, adding a comment at the top of
 default-filters.php would be helpful. For example:

 {{{

 /**
  * This file is used to define default filters and actions for WordPress.
  *
  * Important notes:
  * - Only use functions that are safe to call during the early
 initialization phase.
  * - Functions from `load.php` are generally safe.
  * - Avoid using functions that depend on the full WordPress environment,
 such as `get_option()` and `is_customize_preview()`.
  * - Be cautious with anything that relies on plugins or themes, as they
 may not be fully loaded yet.
  */

 }}}
 This type of comment would help provide guidance to developers on what’s
 safe to use and clarify the purpose of the file.

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


More information about the wp-trac mailing list