Yoast\WP\SEO\Helpers

Social_Profiles_Helper::get_organization_social_profiles()publicYoast 1.0

Gets the organization social profiles stored in the database.

Метод класса: Social_Profiles_Helper{}

Хуков нет.

Возвращает

Массив<Строку,. string> The social profiles for the organization.

Использование

$Social_Profiles_Helper = new Social_Profiles_Helper();
$Social_Profiles_Helper->get_organization_social_profiles();

Код Social_Profiles_Helper::get_organization_social_profiles() Yoast 24.4

public function get_organization_social_profiles() {
	$organization_social_profiles_fields = \array_keys( $this->get_organization_social_profile_fields() );
	$organization_social_profiles        = [];

	foreach ( $organization_social_profiles_fields as $field_name ) {
		$default_value = '';
		if ( $field_name === 'other_social_urls' ) {
			$default_value = [];
		}
		$social_profile_value = $this->options_helper->get( $field_name, $default_value );

		if ( $field_name === 'other_social_urls' ) {
			$other_social_profiles                             = \array_map( '\urldecode', \array_filter( $social_profile_value ) );
			$organization_social_profiles['other_social_urls'] = $other_social_profiles;
			continue;
		}

		if ( $field_name === 'twitter_site' && $social_profile_value !== '' ) {
			$organization_social_profiles[ $field_name ] = 'https://x.com/' . $social_profile_value;
			continue;
		}

		$organization_social_profiles[ $field_name ] = \urldecode( $social_profile_value );
	}

	return $organization_social_profiles;
}