Opened 11 years ago
Closed 11 years ago
#25796 closed defect (bug) (fixed)
capital_P_dangit : why only 'the_title' === current_filter() ?
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.8 | Priority: | normal |
Severity: | trivial | Version: | |
Component: | Formatting | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
function capital_P_dangit( $text ) { // Simple replacement for titles if ( 'the_title' === current_filter() ) return str_replace( 'Wordpress', 'WordPress', $text );
Just curious, why not also wp_title
?
Instead of all this, maybe just preg_replace
it?
Attachments (1)
Change History (9)
#3
in reply to:
↑ 1
@
11 years ago
- Replying to nacin:
Regular expressions are significantly slower than string expressions.
What about calling _x()
in the middle? Should be slow, too.
- 25796.diff is good
- Why only those boundary characters are checked: space, funny quotes, and two types of brackets?
- The first (simple) replace does not care for boundaries. Should it?
- Is completely lowercase 'wordpress' OK?
- Yes, I have more important things to do, sorry :-))))
Note: See
TracTickets for help on using
tickets.
This function is attached to the_content, the_title, and comment_text. Only the_title could benefit from the simple replacement. The others needed to be more judicious (as the next line of the function says). wp_title was added in 3.7, and yeah, it should have been added to the simple replacement piece. Is that what you're asking? 25796.diff
Regular expressions are significantly slower than string expressions.