[wp-trac] [WordPress Trac] #40005: Add some customization ability to WP_TITLE

WordPress Trac noreply at wordpress.org
Wed Mar 1 10:21:46 UTC 2017


#40005: Add some customization ability to WP_TITLE
--------------------------+-----------------------------
 Reporter:  tazotodua     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 by default, `_wp_render_title_tag` function is hooked in `wp_head, 1`  (in
 `wp-includes\general-template.php`):

 {{{#!php
 function _wp_render_title_tag() {
     ....
     echo '<title>' . wp_get_document_title() . '</title>' . "\n";
 }
 }}}


 it leaves us no chance to modify, filter ... the title... (although
 `wp_get_document_title` has some hooks, but not full ability to modify
 full title thought),
 it explicitly echoes the title....  instead, we should have filters,like
 this:

 {{{#!php
 function _wp_render_title_tag() {
     ....
     $title =  '<title>' .  apply_filters('render_title_tag',
 wp_get_document_title() ) . '</title>' . "\n";
     $echo = apply_filters('echo_render_title_tag', true);
     if ($echo) {     echo $title;    }
     else {     return $title;    }

 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40005>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list