Making WordPress.org


Ignore:
Timestamp:
07/02/2019 05:49:32 AM (5 years ago)
Author:
dd32
Message:

Plugin Directory: Reviews: Don't attempt to translate review titles/content, and switch to the Support Forums blog to ensure that template functions work as expected for Reviews.

File:
1 edited

Legend:

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

    r8946 r9016  
    969969            return $content;
    970970        }
    971         return Plugin_I18n::instance()->translate( $section, $content, [ 'post_id' => $post_id ] );
     971
     972        $post = get_post( $post_id );
     973
     974        // Only translate Plugin post objects
     975        if ( $post && 'plugin' === $post->post_type ) {
     976            return Plugin_I18n::instance()->translate( $section, $content, [ 'post_id' => $post_id ] );
     977        }
     978
     979        return $content;
    972980    }
    973981
     
    982990        $post = get_post( $post_id );
    983991
    984         // The $post_id passed may be a Support Forum post ID, which thankfully is much higher than plugins ID's for now.
    985         if ( $post instanceof \WP_Post ) {
    986             $title = Plugin_I18n::instance()->translate( 'title', $title, [ 'post_id' => $post ] );
     992        // Only translate Post type items.
     993        if ( $post && $post->post_type === 'plugin' ) {
     994            return Plugin_I18n::instance()->translate( 'title', $title, [ 'post_id' => $post ] );
    987995        }
    988996
     
    9981006     */
    9991007    public function translate_post_excerpt( $excerpt, $post ) {
    1000         return Plugin_I18n::instance()->translate( 'excerpt', $excerpt, [ 'post_id' => $post ] );
     1008        $post = get_post( $post );
     1009
     1010        // Only translate Post type items.
     1011        if ( $post && $post->post_type === 'plugin' ) {
     1012            return Plugin_I18n::instance()->translate( 'excerpt', $excerpt, [ 'post_id' => $post ] );
     1013        }
     1014
     1015        return $excerpt;
    10011016    }
    10021017
Note: See TracChangeset for help on using the changeset viewer.