Skip to content

Instantly share code, notes, and snippets.

@BeardedGinger
Created October 27, 2016 18:01
Show Gist options
  • Save BeardedGinger/043834ae676f3bf3e3dfa9ca0ef07ff3 to your computer and use it in GitHub Desktop.
Save BeardedGinger/043834ae676f3bf3e3dfa9ca0ef07ff3 to your computer and use it in GitHub Desktop.
<?php
add_filter( 'user_contactmethods', 'limecuda_public_yoast_contactmethods', 20, 1 );
/**
* If you're using the Yoast SEO plugin, there are contact methods available on user profiles
* to add Facebook, Twitter, and Google+ information for the user.
*
* However, with the way they are added, they're only available within the admin. So,
* if you're trying to create an author template which automatically pulls all the registered
* contact methods, these Yoast methods will not be returned.
*
* This function will make these contact methods available to wp_get_user_contact_methods().
*
* @param array $methods The registered contact methods.
*/
function limecuda_public_yoast_contactmethods( $methods ) {
if ( ! function_exists( 'wpseo_init' ) )
return $methods;
$methods['googleplus'] = __( 'Google+', 'wordpress-seo' );
$methods['twitter'] = __( 'Twitter username (without @)', 'wordpress-seo' );
$methods['facebook'] = __( 'Facebook profile URL', 'wordpress-seo' );
return $methods;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment