Make WordPress Core

Opened 10 years ago

Closed 2 years ago

Last modified 2 years ago

#38650 closed enhancement (fixed)

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

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

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 2 years ago.

Download all attachments as: .zip

Change History (4)

#1 @DrewAPicture
9 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
2 years ago

#2 @jorbin
2 years ago

  • Keywords has-patch added
  • Milestone Awaiting Review → 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
2 years ago

  • Owner set to jorbin
  • Resolution → fixed
  • Status new → 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.