Allow Profile HTML for select users

You can hook on an early action and apply the filter for your use case:

add_action( 'load-profile.php', 'allow_profile_html_wpse_91564' );

function allow_profile_html_wpse_91564()
{
    global $current_user;
    if( '2' == $current_user->ID )
        remove_filter('pre_user_description', 'wp_filter_kses');
}

The hook load-$pagenow runs in all default admin pages (i.e., not added by a third party), and it’s declared in the file /wp-admin/admin.php.

$pagenow is the PHP page running at a given moment. So, to target the page /wp-admin/user-edit.php?user_id=2, another hook is needed and also another conditional checking:

add_action( 'load-user-edit.php', 'callback_function' );

function allow_user_html_wpse_91564()
{        
    if( isset( $_REQUEST['user_id'] ) && '2' == $_REQUEST['user_id'] )
        remove_filter( 'pre_user_description', 'wp_filter_kses' );    
}

Leave a Comment

tech