I have installed a plugin in wordpress that allows inserting registration forms for users with custom fields (in my case, "Company" and "CIF")
The insertion of data is done correctly, but I also want to show them in the users section as in the screenshot that I attached:
To do this, I am using the following functions that I add to the file functions.php
:
function theme_add_user_company_column( $columns ) {
$columns['company'] = __( 'Compañía', 'theme' );
return $columns;
}
add_filter( 'manage_users_columns', 'theme_add_user_company_column' );
With this I have created the column that is displayed in Users
function theme_show_user_company_data( $value, $column_name, $user_id ) {
if( 'company' == $column_name ) {
return get_user_meta($user_id , 'company', true );
} // end if
} // end theme_show_user_zip_code_data
add_action( 'manage_users_custom_column', 'theme_show_user_company_data', 10, 3 );
With this other I have filled the column with the records that I have entered in the form.
The problem I have is that when trying the same for CIF, the company data stops appearing. I can only show one type of data each time and I do not know why it can be.