Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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 );
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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