Yoast\WP\SEO\Generators\Schema
Person::get_social_profiles()
Retrieve a list of social profile URLs for Person.
Метод класса: Person{}
Хуки из метода
Возвращает
Строку[]
. A list of SameAs URLs.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_social_profiles( $same_as_urls, $user_id );
- $same_as_urls(string[]) (обязательный)
- Array of SameAs URLs.
- $user_id(int) (обязательный)
- User ID.
Код Person::get_social_profiles() Person::get social profiles Yoast 22.4
protected function get_social_profiles( $same_as_urls, $user_id ) { /** * Filter: 'wpseo_schema_person_social_profiles' - Allows filtering of social profiles per user. * * @param string[] $social_profiles The array of social profiles to retrieve. Each should be a user meta field * key. As they are retrieved using the WordPress function `get_the_author_meta`. * @param int $user_id The current user we're grabbing social profiles for. */ $social_profiles = \apply_filters( 'wpseo_schema_person_social_profiles', $this->social_profiles, $user_id ); // We can only handle an array. if ( ! \is_array( $social_profiles ) ) { return $same_as_urls; } foreach ( $social_profiles as $profile ) { // Skip non-string values. if ( ! \is_string( $profile ) ) { continue; } $social_url = $this->url_social_site( $profile, $user_id ); if ( $social_url ) { $same_as_urls[] = $social_url; } } return $same_as_urls; }