Make WordPress Core

Opened 19 years ago

Closed 18 years ago

Last modified 17 years ago

#1947 closed enhancement (fixed)

Filter request for Wordpress title wp_title() {without exception}

Reported by: mani_monaj's profile mani_monaj Owned by: ryan's profile ryan
Milestone: Priority: high
Severity: normal Version: 1.6
Component: General Keywords: header, wp_head, wp_title
Focuses: Cc:


For some i18n purposes we need to change some values like month names and title constants in some conditions. There is now one action hook wp_head that works when wp_head(); function get called , As we need some data change just before header starts (not after init) , I suggest new action hook wp_head_start in template-functions-general.php get_header() function.

Attachments (1)

template-functions-general.php.diff.txt (430 bytes) - added by mani_monaj 19 years ago.

Download all attachments as: .zip

Change History (8)

#1 @masquerade
19 years ago

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

I fail to see the purpose here.

If you need a hook before headers are sent, use init.
If you need a hook inside the head tag of themes, use wp_head

Adding a wp_head_start in the suggested location could not be guarnateed to give the expected results. Themes are not required to use get_header(), or to place it as the first line in any theme file, and may choose to output first. And, this location is about 3 steps after the init hook is run, i.e. do_action('init'); wp(); gzip_compression(); require('template-loader.php');

#2 @ryan
18 years ago

I think we need specific examples od what you need to do. Working code would be helpful. Perhaps the filter would be better placed somewhere in the blog header initialization sequence. As masquerade mentions, usage of get_header() in themes is not reliable.

#3 @mani_monaj
18 years ago

  • Keywords wp_title added
  • Resolution invalid deleted
  • Status changed from closed to reopened
  • Summary changed from Action hook request for Wordpress Header Start to Filter request for Wordpress title wp_title() {without exception}

Let me describe the topic in depth ,

Wordpress uses $month array for month name and use it when generating titles, in Persian(Farsi-Iranian) i18n , our month names are different , we made a plugin for converting dates and it works fine , but we can not change titles because there is no action/filter for that ,

imagine that someone wants to browse [Persian Mode - It works now] , He/She most get this title Archive->1384->Mordad not Archive->1384->May,

Because wordpress uses $wp_query->query_varsm? for month number and fethes the name from $month array , we should find a way to change $month array JUST in header , before title and restore it before </head>.

As it discussed here and in mailing list , I got convinced it's impossible to add this action hook , but what about a filter hook for wp_title?

#4 @ryan
18 years ago

[3274] adds a wp_title filter. This should allow you to write your own title generator. Will that work for you?

#5 @ryan
18 years ago

  • Milestone set to 2.0
  • Owner changed from anonymous to ryan
  • Status changed from reopened to new

#6 @mani_monaj
18 years ago

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

Thanks Ryan , Great IDea , Problem resolved!

#7 @(none)
17 years ago

  • Milestone 2.0 deleted

Milestone 2.0 deleted

Note: See TracTickets for help on using tickets.