[wp-trac] [WordPress Trac] #36377: problem in titles

WordPress Trac noreply at wordpress.org
Wed Mar 30 22:08:12 UTC 2016


#36377: problem in titles
--------------------------+-----------------------------
 Reporter:  selnomeria    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 hi.
 for example, my blog name is "Steve Hastink Portal"..

 when visitor goes to SEARCH page or 404 page,
 in `wp-includes/general_template.php`, in `wp_title` function, there is
 coded:

 {{{#!php
 ....
         // If it's a search
         if ( is_search() ) {
                 /* translators: 1: separator, 2: search phrase */
                 $title = sprintf(__('Search Results %1$s %2$s'), $t_sep,
 strip_tags($search));
         }

         // If it's a 404 page
         if ( is_404() ) {
                 $title = __('Page not found');
         }


 ....
 }}}

 do you know what that means?  that means, when you are on SEARCH or 404
 page, then title's last character is not SEPARATOR(or space), so, when the
 above code continues, there is coded:

 {{{#!php
 // Determines position of the separator and direction of the breadcrumb
         if ( 'right' == $seplocation ) { // sep on right, so reverse the
 order
                 $title_array = array_reverse( $title_array );
                 $title       = implode( " $sep ", $title_array ) .
 $prefix;
         } else {
                 $title = $prefix . implode( " $sep ", $title_array );
         }
 }}}

 so, in such cases, the final title becomes.. :

 `'|Page not foundSteve Hastink Portal"`
 or for search results (i.e. search phraze "blabla"):
 `'|Search Results - blablaSteve Hastink Portal"`

  the only solution i could use, is the phraze `"right"` as the 3rd
 argument in  `echo wp_title("|", false, "right");` so title becomes:

 'Page not found|Steve Hastink Portal"

 but i think, it's bug of WP. there should be space character in the end of
 404 or Search_results page.

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


More information about the wp-trac mailing list