Yoast\WP\SEO\Actions\Configuration
First_Time_Configuration_Action::set_site_representation()
Stores the values for the site representation.
Метод класса: First_Time_Configuration_Action{}
Хуков нет.
Возвращает
Объект
. The response object.
Использование
$First_Time_Configuration_Action = new First_Time_Configuration_Action(); $First_Time_Configuration_Action->set_site_representation( $params );
- $params(массив) (обязательный)
- The values to store.
Код First_Time_Configuration_Action::set_site_representation() First Time Configuration Action::set site representation Yoast 20.0
public function set_site_representation( $params ) { $failures = []; foreach ( self::SITE_REPRESENTATION_FIELDS as $field_name ) { if ( isset( $params[ $field_name ] ) ) { if ( $field_name === 'description' && \current_user_can( 'manage_options' ) ) { $result = \update_option( 'blogdescription', $params['description'] ); if ( ! $result && $params['description'] === \get_option( 'blogdescription' ) ) { $result = true; } } else { $result = $this->options_helper->set( $field_name, $params[ $field_name ] ); } if ( ! $result ) { $failures[] = $field_name; } } } // Delete cached logos in the db. $this->options_helper->set( 'company_logo_meta', false ); $this->options_helper->set( 'person_logo_meta', false ); if ( \count( $failures ) === 0 ) { return (object) [ 'success' => true, 'status' => 200, ]; } return (object) [ 'success' => false, 'status' => 500, 'error' => 'Could not save some options in the database', 'failures' => $failures, ]; }