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

WordPress Trac noreply at wordpress.org
Wed Mar 1 13:14:28 UTC 2017


#40005: Add some customization ability to WP_TITLE
--------------------------+------------------------------
 Reporter:  tazotodua     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Themes        |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  close         |     Focuses:
--------------------------+------------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:2 tazotodua]:
 > that fitler has to fully replace title.

 Not necessarily, you could do something like this:
 {{{
 function wp40005_filter_document_title( $title ) {
         remove_filter( 'pre_get_document_title', __FUNCTION__ );

         $title = wp_get_document_title();

         add_filter( 'pre_get_document_title', __FUNCTION__ );

         // Change the output
         // $title = ...

         return $title;
 }
 add_filter( 'pre_get_document_title', 'wp40005_filter_document_title' );
 }}}

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


More information about the wp-trac mailing list