Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#2347 closed defect (bug) (fixed)

"core_files_loaded" action cannot be used... get rid of it!

Reported by: markjaquith Owned by: markjaquith
Milestone: Priority: lowest
Severity: normal Version: 2.0
Component: Administration Keywords: bg|has-patch bg|commit deprecated hook action core_files_loaded
Focuses: Cc:


Skeltoac pointed out something to me in #wordpress: the "core_files_loaded" action hook is useless. It happens immediately after functions are loaded (so right after add_action() becomes available), but before my-hacks.php and plugins are loaded. Furthermore, plugins are loaded right afterwards... so there's no need for a hook there... a plugin can just run its code "live." I've commented the action out (no harm, nothing can use it, and no one is even trying) and marked it as deprecated.

skeltoac: MarkJaquith: What kind of person would use the "core_files_loaded" hook?
skeltoac: That's the hook that comes just before my-hacks and plugins.
MarkJaquith: skeltoac: hrm... caching?
MarkJaquith: advanced-cache.php thing, maybe
skeltoac: MarkJaquith: cache files are loaded before functions.php, so there isn't even a function "add_action" by then.
MarkJaquith: skeltoac: hm... so basically the thing is useless.  The only thing that could use it is WP, internally, and what's the point?
skeltoac: Must be only for core stuff, or else serious core hackers.
MarkJaquith: yeah, but how would you implement it?  you'd have to edit core code, right?
io_error: skeltoac: I might use core_files_loaded
skeltoac: io_error: How?
skeltoac: It's not even used by any core files.
MarkJaquith: can't use it from a plugin, can't use it from pluggable-functions.php, can't use it from index.php or wp-config.php
skeltoac: You'd have to manipulate $wp_filter without the help of add_action and you'd have to do it in a cache file or a db replacement file.
MarkJaquith: not recommended to work around the helper functions like that...
MarkJaquith: my-hacks.php is right after, and then plugins follow... you could just run the command live in the plugin.
skeltoac: Yeah, I don't mean to confuse anyone, I just wondered if there was any conceivable use for that hook. It suddenly struck me that it's in a strange place.
MarkJaquith: skeltoac: you're right.  It's useless.  I'm going to mark it as deprecated.

Attachments (1)

wp-settings.php.diff (485 bytes) - added by markjaquith 12 years ago.
Patch for WP SVN

Download all attachments as: .zip

Change History (4)

12 years ago

Patch for WP SVN

#1 @markjaquith
12 years ago

  • Owner changed from anonymous to markjaquith

#2 @ryan
12 years ago

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

(In [3499]) Remove core_files_loaded action due to general uselessness. fixes #2347

#3 @(none)
11 years ago

  • Milestone 2.0.1 deleted

Milestone 2.0.1 deleted

Note: See TracTickets for help on using tickets.