WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#36377 closed defect (bug) (invalid)

problem in titles

Reported by: selnomeria Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

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:

....
        // 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:

// 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.

Change History (2)

#1 @selnomeria
4 years ago

  • Resolution set to invalid
  • Status changed from new to closed

#2 @DrewAPicture
4 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.