[wp-trac] [WordPress Trac] #37409: Broken & illogic conditional check in wp_get_document_title()

WordPress Trac noreply at wordpress.org
Tue Jul 19 11:53:25 UTC 2016


#37409: Broken & illogic conditional check in wp_get_document_title()
--------------------------+-----------------------------
 Reporter:  ReneHermi     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.5.3
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 {{{

         /*
          * If we're on the blog page that is not the homepage or
          * a single post of any post type, use the post title.
          */
     } elseif( is_home() || is_singular() ) {
         $title = the_title_attribute('echo=0');


 }}}

 should be changed to:

 {{{

         /*
          * If we're on the blog page that is not the homepage or
          * a single post of any post type, use the post title.
          */
     } elseif( !is_home() || is_singular() ) {
         $title = the_title_attribute('echo=0');


 }}}

 For now it does not lead to wrong title because the previous condition
 is_front_page() is catching this before it throws out a wrong title but it
 should be fixed before it leads to issues when someone decided to do some
 changes on wp_get_document_title().

 You can reproduce a possible error with commenting the condition
 is_front_page() in wp_get_document_title(). Than visit a frontpage with
 multiple blog posts. You will see that the wp_get_document_title() will
 return than the title of the first blog post and not the site title as
 expected.

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


More information about the wp-trac mailing list