Skip to content

Instantly share code, notes, and snippets.

@mauriciogofas
Created February 6, 2015 02:47
Show Gist options
  • Save mauriciogofas/8ab8dec28e07b270485d to your computer and use it in GitHub Desktop.
Save mauriciogofas/8ab8dec28e07b270485d to your computer and use it in GitHub Desktop.
Replace user profile fields wp (não testado)
<?php
//fonte: https://wordpress.org/support/topic/incompatibility-with-custom-profile-fields
// Replace user profile fields
function add_twitter_contactmethod( $contactmethods ) {
// Add Twitter
if ( !isset( $contactmethods['twitter'] ) )
$contactmethods['twitter'] = 'Twitter url';
if ( !isset( $contactmethods['facebook url'] ) )
$contactmethods['facebook'] = 'Facebook url';
if ( !isset( $contactmethods['gplus'] ) )
$contactmethods['gplus'] = 'GPlus url';
// Remove Yahoo IM
if ( isset( $contactmethods['yim'] ) )
unset( $contactmethods['yim'] );
// Remove AIM
if ( isset( $contactmethods['aim'] ) )
unset( $contactmethods['aim'] );
// Remove Jabber/ Google Talk
if ( isset( $contactmethods['jabber'] ) )
unset( $contactmethods['jabber'] );
return $contactmethods;
}
add_filter( 'user_contactmethods', 'add_twitter_contactmethod', __('add_facebook_contactmethod', __('add_gplus_contactmethod', 10, 1 )));
//end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment