Refactor <title> tag content generation
|Reported by:||sirzooro||Owned by:|
At this moment default theme uses following code to generate <title> tag:
<title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title>
Other templates uses something similar. Unfortunately this approach does not allow to completely control the title from plugins, so plugins (mainly SEO ones) uses output buffering and some kind of string search/replace to overcome this. This works, but is not good from performance perspective. Also this may produce unexpected results due to interaction between two such plugins, when one of them does not handle this correctly.
The easiest approach is to move <title> generation to backend completely, or pass whole title through new filter in template.
Because SEO plugins calls ob_start() before header.php file is loaded, we need to develop some kind of mechanism (or extend existing one if exists) so template can inform others that it supports the new approach. Plugins could then check this and either register handler for new title hook or call ob_start(). I think of new function, which should take an associative array or URI-param-like string. This function will be called from template's functions.php file.
I can write patch for this. Please let me know what do you think about my idea, and give me advice which approach should I take to implement the "template features" mechanism.
Change History (5)
- Keywords has-patch added; needs-patch removed
- Milestone changed from Future Release to 3.0