Changeset 9016 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
- Timestamp:
- 07/02/2019 05:49:32 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r8946 r9016 969 969 return $content; 970 970 } 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; 972 980 } 973 981 … … 982 990 $post = get_post( $post_id ); 983 991 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 ] ); 987 995 } 988 996 … … 998 1006 */ 999 1007 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; 1001 1016 } 1002 1017
Note: See TracChangeset
for help on using the changeset viewer.