Do you want to add links beside the edit button in the Users panel when you hover over a user? Our code snippets use custom user_row_actions to add the links.
Instructions:
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin.
If you have already added new contact methods, like Facebook, Twitter, etc. you can ignore the extra fields snippet and just use the second snippet.
Snippet #1 (Extra Fields)
function add_contactmethods( $contactmethods ) { $contactmethods['twitter'] = 'Twitter'; $contactmethods['facebook'] = 'Facebook'; return $contactmethods; } add_filter('user_contactmethods','add_contactmethods',10,1);
Snippet #2:
function profile_links( $actions, $user_object ) { $actions['website'] = '<a href="'.$user_object->user_url.'" target="_blank">WS</a>'; $actions['facebook'] = '<a href="'.$user_object->facebook.'" target="_blank">FB</a>'; $actions['twitter'] = '<a href="'.$user_object->twitter.'" target="_blank">TW</a>'; return $actions; } add_filter( 'user_row_actions', 'profile_links', 10, 2 );
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 62 best free WordPress blog themes or 7 best WordPress contact form plugins.
The snippet works but it places the site url before the facebook and twitter link
Example:
mysite.com/www.facebook.com/user
mysite.com/www.twitter.com/user
Any advice, Thanks
We tested this just now, and it’s working fine for us. You may want to check that the URLs for the Facebook and Twitter pages are correct.
i would like to add a custom filed but to the category page , a thumbnail field for categories !
can you show me how to do that please ?