Skip to content

Instantly share code, notes, and snippets.

@ipokkel
Created June 24, 2024 08:22
Show Gist options
  • Save ipokkel/3f934e8675ba5cc30e3c5de7a72b4d98 to your computer and use it in GitHub Desktop.
Save ipokkel/3f934e8675ba5cc30e3c5de7a72b4d98 to your computer and use it in GitHub Desktop.
<?php
/**
* Show the display name field for administrators in the WordPress dashboard.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_ffl_show_display_name_for_admins( $hide_display_name, $user ) {
// bail if not in dashboard and not an administrator
if ( is_admin() && $hide_display_name && current_user_can( 'edit_users' ) ) {
return false;
}
return $hide_display_name;
}
add_filter( 'pmpro_ffl_hide_display_name_profile', 'my_ffl_show_display_name_for_admins', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment