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 24.4
public function set_site_representation( $params ) { $failures = []; $old_values = $this->get_old_values( self::SITE_REPRESENTATION_FIELDS ); foreach ( self::SITE_REPRESENTATION_FIELDS as $field_name ) { if ( isset( $params[ $field_name ] ) ) { $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 ); /** * Action: 'wpseo_post_update_site_representation' - Allows for Hiive event tracking. * * @param array $params The new values of the options. * @param array $old_values The old values of the options. * @param array $failures The options that failed to be saved. * * @internal */ \do_action( 'wpseo_ftc_post_update_site_representation', $params, $old_values, $failures ); 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, ]; }