Making WordPress.org


Ignore:
Timestamp:
01/11/2018 10:26:59 PM (7 years ago)
Author:
obenland
Message:

Plugins: Translate plugin name in document title.

Fixes #3374.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r6287 r6353  
    519519        add_filter( 'the_content', array( $this, 'translate_post_content' ), 1, 2 );
    520520        add_filter( 'the_title', array( $this, 'translate_post_title' ), 1, 2 );
     521        add_filter( 'single_post_title', array( $this, 'translate_post_title' ), 1, 2 );
    521522        add_filter( 'get_the_excerpt', array( $this, 'translate_post_excerpt' ), 1, 2 );
    522523
     
    916917     */
    917918    public function translate_post_title( $title, $post_id = null ) {
    918         $post = get_post();
    919 
    920         if ( $post instanceof \WP_Post && $post_id === $post->ID ) {
     919        $post = get_post( $post_id );
     920
     921        if ( $post instanceof \WP_Post ) {
    921922            $title = Plugin_I18n::instance()->translate( 'title', $title, [ 'post_id' => $post ] );
    922923        }
Note: See TracChangeset for help on using the changeset viewer.