Skip to content

Instantly share code, notes, and snippets.

@yuriinalivaiko
Last active November 23, 2024 12:21
Show Gist options
  • Select an option

  • Save yuriinalivaiko/3ffd7ee10dd042265056c0cf450e51b1 to your computer and use it in GitHub Desktop.

Select an option

Save yuriinalivaiko/3ffd7ee10dd042265056c0cf450e51b1 to your computer and use it in GitHub Desktop.
This code snippet adds fields to the main Account tab.
<?php
// Add pre-defined fields to the main Account tab.
function um_account_tab_general_fields( $args, $shortcode_args ) {
// Fields Meta Keys.
$args .= ',birth_date';
$args .= ',country';
$args .= ',languages';
return $args;
}
add_filter( 'um_account_tab_general_fields', 'um_account_tab_general_fields', 10, 2 );
@yuriinalivaiko
Copy link
Author

yuriinalivaiko commented Sep 6, 2022

This gist is a part of the article How to display pre-defined fields in Account.

You can add the code to the functions.php file in the child theme directory. You also may use the Code Snippets plugin to add a code snippet.

NOTE: This is a solution for pre-defined fields only. This code does not work with custom fields.
You can see all available predefined fields in the "Predefined Fields" section in the Fields Manager.

You can use a free extension Ultimate Member - Account tabs to display custom fields in Account. This extension can embed a profile form into the custom account tab.

@BlackStar1991
Copy link

Thanks, Could you add all list of this meta keys ? Or where is this list?

@aliasmat
Copy link

aliasmat commented Feb 7, 2023

@BlackStar1991 the meta keys refer to the "column_headings" such as ID, user_name in the two tables "wp_users" and wp_usermeta". We define our own meta keys when creating a form with Ultimate Member. However, in my case, using these meta keys didn't work. I tried in many ways and could remove some of the fields from the default form but couldn't add a new field.

@polmonta
Copy link

polmonta commented Aug 9, 2024

Text boxes are not being displayed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment