So I have many custom user profile fields.

When I use do_action( 'show_user_profile', $profileuser ); hook it displays all custom user profile fields..

But I would like to show only certain fields.

For example

add_action('show_user_profile', 'add_extra_profile_fields1');

function add_extra_profile_fields1() {
    // add extra profile fields to user edit page

add_action('show_user_profile', 'add_extra_profile_fields2');

function add_extra_profile_fields2() {
    // add extra profile fields to user edit page

Now is there a way to display only add_extra_profile_fields2 using show_user_profile hook?


You could either find the hook that is outputting all those extra fields and use remove_action on it.

Or you can just create your own hook:

do_action( 'my_theme_show_user_profile', $profile_user );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.