Make WordPress Core

Opened 8 years ago

Closed 8 months ago

Last modified 7 months ago

#38650 closed enhancement (fixed)

Provide some guidance on what conditionals can/should be used in default-filters.php

Reported by: helen's profile helen Owned by: jorbin's profile jorbin
Milestone: 6.7 Priority: low
Severity: minor Version:
Component: Bootstrap/Load Keywords: has-patch
Focuses: docs Cc:

Description

There are a lot of things you can't use in default-filters.php, such as get_option() or is_customize_preview(). Those deeply familiar with how load works might have some idea as to what's safe and what isn't, but it's generally confusing and a little opaque. I'd suggest some kind of inline comment at the top explaining the point of the file and what's generally safe (i.e. stuff in load.php as I understand?).

Attachments (1)

38650.diff (724 bytes) - added by jorbin 8 months ago.

Download all attachments as: .zip

Change History (4)

#1 @DrewAPicture
8 years ago

@helen How specific would you imagine this blurb being? I mean, we can generally outline that the file is loaded after specific files have loaded, e.g. load, class-wp, wp-db, etc. Might also mention that it's effectively loaded before multisite is initialized. I'm not just sure how you envision of the structure of the comment going.

@jorbin
8 months ago

#2 @jorbin
8 months ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 6.7

I think a small note of caution makes sense here. I've added a first draft at the wording, but open to feedback from others.

#4 @jorbin
8 months ago

  • Owner set to jorbin
  • Resolution set to fixed
  • Status changed from new to closed

In 58944:

Bootstrap/Load: Add Words of warning about load order.

Since this file is loaded incredibly early, many functions are not available. Those deeply familiar with how load works might have some idea as to what's safe and what isn't, but it's generally confusing and a little opaque so let's warn people there be dragons.

Props helen, DrewAPicture, jorbin.
Fixes #38650.

Note: See TracTickets for help on using tickets.