X

How to Add Custom Links to the WordPress Users Panel

Snippets by IsItWP

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.

add custom user_row_actions website facebook twitter

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.

Comments   Leave a Reply

  1. 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

    1. 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.

  2. 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 ?

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!