Opened 12 years ago
Closed 11 years ago
#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. "
Attachments (1)
Change History (7)
#3
in reply to:
↑ 2
;
follow-up:
↓ 5
@
12 years 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 proposedafter_load_locale
hook would run before the theme'sfunctions.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 .
#4
@
11 years 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.)
#5
in reply to:
↑ 3
@
11 years 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?
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 proposedafter_load_locale
hook would run before the theme'sfunctions.php
is included.