WordPress.org

Make WordPress Core

#23758 closed enhancement (wontfix)

Add hook after loading WordPress locale object

Reported by: alex-ye Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5.1
Component: I18N Keywords: has-patch reporter-feedback
Focuses: Cc:

Description

We face some problems when we work on bbPress last month , see :
http://bbpress.trac.wordpress.org/ticket/2219

There is no proper hook to add roles ( an example ) in WordPress ,
especially when you use a translated display name ..

You can also read some lame in bbPress source code
"This is kind of lame, but is all we have for now. "

http://bbpress.trac.wordpress.org/changeset/4773

Attachments (1)

wp-settings.php.patch (768 bytes) - added by alex-ye 13 months ago.

Download all attachments as: .zip

Change History (7)

alex-ye13 months ago

comment:1 alex-ye13 months ago

  • Cc nashwan.doaqan@… added
  • Version set to 3.5.1

comment:2 follow-up: SergeyBiryukov13 months ago

  • Type changed from defect (bug) to enhancement

"This is kind of lame, but is all we have for now. "

For reference, this was added in [BB4350].

The newer comment (in [BB4773]) says: "...hook in immediately after everything is included (including the theme's functions.php)". after_setup_theme seems to be the correct action for that, since the proposed after_load_locale hook would run before the theme's functions.php is included.

comment:3 in reply to: ↑ 2 ; follow-up: alex-ye13 months ago

Replying to SergeyBiryukov:

"This is kind of lame, but is all we have for now. "

For reference, this was added in [BB4350].

The newer comment (in [BB4773]) says: "...hook in immediately after everything is included (including the theme's functions.php)". after_setup_theme seems to be the correct action for that, since the proposed after_load_locale hook would run before the theme's functions.php is included.

Yes , but I disagree with you about the correct action , Maybe some calls in theme's functions.php require that the roles must be added before ..

Many hooks in WordPress run before the theme's functions.php is included and this is not something to claim about .. after_load_locale hook can be useful for plugins and not only for adding roles .. I think it could be used in many things .

comment:4 nacin13 months ago

Roles should be added on init. Also, in general, the rule of thumb is that if you need translations, then wait for init. (Themes can jump the gun at after_setup_theme as well, but init is a more obvious and generic hook.)

comment:5 in reply to: ↑ 3 SergeyBiryukov12 months ago

  • Keywords close reporter-feedback added

Replying to alex-ye:

Many hooks in WordPress run before the theme's functions.php is included and this is not something to claim about ..

I've counted 7:

  • muplugins_loaded
  • registered_taxonomy
  • registered_post_type
  • plugins_loaded
  • sanitize_comment_cookies
  • setup_theme
  • load_textdomain

after_load_locale hook can be useful for plugins and not only for adding roles .. I think it could be used in many things .

As noted above, roles should be added on init. Do you have a specific use case that cannot be accomplished using existing actions?

comment:6 SergeyBiryukov10 months ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.