Yoast\WP\SEO\Helpers
Social_Profiles_Helper::get_person_social_profiles()
Gets the person social profiles stored in the database.
Метод класса: Social_Profiles_Helper{}
Хуков нет.
Возвращает
Массив
. The person's social profiles.
Использование
$Social_Profiles_Helper = new Social_Profiles_Helper(); $Social_Profiles_Helper->get_person_social_profiles( $person_id );
- $person_id(int) (обязательный)
- The id of the person.
Код Social_Profiles_Helper::get_person_social_profiles() Social Profiles Helper::get person social profiles Yoast 24.3
public function get_person_social_profiles( $person_id ) { $social_profile_fields = \array_keys( $this->get_person_social_profile_fields() ); $person_social_profiles = \array_combine( $social_profile_fields, \array_fill( 0, \count( $social_profile_fields ), '' ) ); // If no person has been selected, $person_id is set to false. if ( \is_numeric( $person_id ) ) { foreach ( \array_keys( $person_social_profiles ) as $field_name ) { $value = \get_user_meta( $person_id, $field_name, true ); // If $person_id is an integer but does not represent a valid user, get_user_meta returns false. if ( ! \is_bool( $value ) ) { $person_social_profiles[ $field_name ] = $value; } } } return $person_social_profiles; }