Make WordPress Core

Ticket #34879: 34879-2.patch

File 34879-2.patch, 1.5 KB (added by dossy, 10 years ago)
  • tests/phpunit/tests/general/document-title.php

     
    243243        function _change_title_separator( $sep ) {
    244244                return '%%';
    245245        }
     246
     247        /**
     248         * @ticket 34879
     249         */
     250        function test_wp_title_t_sep_typo() {
     251                update_option( 'show_on_front', 'page' );
     252
     253                $this->go_to( '/' );
     254
     255                global $wp_query;
     256                $wp_query->queried_object = $wp_query->post;
     257                $wp_query->queried_object_id = (int) $wp_query->queried_object->ID;
     258
     259                $old_title = $wp_query->post->post_title;
     260                $wp_query->post->post_title = 'test%WP_TITLE_SEP%title';
     261
     262                $this->assertEquals( ' » test » title', wp_title( '»', false ) );
     263
     264                $wp_query->post->post_title = $old_title;
     265                update_option( 'show_on_front', 'posts' );
     266        }
    246267}
  • src/wp-includes/general-template.php

     
    995995        $search   = get_query_var( 's' );
    996996        $title    = '';
    997997
    998         $t_sep = '%WP_TITILE_SEP%'; // Temporary separator, for accurate flipping, if necessary
     998        $t_sep = '%WP_TITLE_SEP%'; // Temporary separator, for accurate flipping, if necessary
    999999
    10001000        // If there is a post
    10011001        if ( is_single() || ( is_home() && ! is_front_page() ) || ( is_page() && ! is_front_page() ) ) {