• Thu. Dec 9th, 2021

customization – Custom field not editable by the user


Oct 17, 2021

I have a custom field. The field is visible and editable by the user, moreover I also view it in the user table on the administrator side.

If I want to make this field uneditable for the user (but visible) what can I do?

I don’t want to use plugins like adf or similar

function my_new_contactmethods( $contactmethods ) {
    //add Nickname Telegram
    $contactmethods['telegram'] = 'Nickname Telegram';
    //$contactmethods['subscription'] = 'Subscription until';
    return $contactmethods;

function new_modify_user_table( $column ) {
    $column['telegram'] = 'Telegram';
    return $column;
add_filter( 'manage_users_columns', 'new_modify_user_table' );

function new_modify_user_table_row( $val, $column_name, $user_id ) {
    switch ($column_name) {
        case 'telegram' :
            return get_the_author_meta( 'telegram', $user_id );
    return $val;
add_filter( 'manage_users_custom_column', 'new_modify_user_table_row', 10, 3 );


Leave a Reply

Your email address will not be published. Required fields are marked *