$description ) ); return; } catch ( \Throwable $error ) { $reason = $error->getMessage(); } } ( new NullAdapter() )->write( $post_id, $description ); EventLog::add( EventLog::TYPE_API_ERROR, sprintf( /* translators: %s: error message */ __( 'The meta description could not be stored in All in One SEO and was kept by Aivor Content Import instead: %s', 'aivor-content-import' ), $reason ), array( 'level' => EventLog::LEVEL_WARNING, 'post_id' => $post_id, ) ); } /** * Die gesetzte Meta-Description, leer wenn keine. * * @param int $post_id Beitrag. * @return string */ public function read( int $post_id ): string { if ( ! self::is_available() ) { return ''; } try { $post = call_user_func( array( self::MODEL, 'getPost' ), $post_id ); return is_object( $post ) && isset( $post->description ) ? (string) $post->description : ''; } catch ( \Throwable $error ) { return ''; } } /** * Ob das Datenmodell von AIOSEO geladen ist. * * @return bool */ public static function is_available(): bool { return class_exists( self::MODEL ) && is_callable( array( self::MODEL, 'savePost' ) ); } }