WordPress.org

Making WordPress.org

Changeset 3451


Ignore:
Timestamp:
06/19/2016 09:03:37 AM (5 years ago)
Author:
obenland
Message:

Plugin Directory: Fix undefined property notices on rosetta sites.

See #1691.

File:
1 edited

Legend:

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

    r3449 r3451  
    508508     */
    509509    public function translate_post_title( $title, $post_id ) {
    510         if ( $post_id === get_post()->ID ) {
    511             return Plugin_I18n::instance()->translate( 'title', $title );
    512         }
     510        $post = get_post();
     511
     512        if ( $post instanceof \WP_Post && $post_id === $post->ID ) {
     513            $title = Plugin_I18n::instance()->translate( 'title', $title );
     514        }
     515
    513516        return $title;
    514517    }
     
    530533    public function append_meta_for_jetpack() {
    531534        // TEMP: only do this for low numbered plugin IDs, till we're sure it works.
    532         if ( get_post()->ID > 200 )
     535        $post = get_post();
     536        if ( $post instanceof \WP_Post && $post->ID > 200 )
    533537            return;
    534538
Note: See TracChangeset for help on using the changeset viewer.