How do I display a custom field in an existing form on the front end?

This worked for me: In the template file (used with that existing form), before the get_header(); call/line, add this code: global $my_dates_MB; // If you changed the meta box ID (i.e. mydates), change it also below. add_filter( ‘rwmb_show_mydates’, ‘__return_false’ ); $meta_boxes = get_dates( [] ); $my_dates_MB = rwmb_get_meta_box( $meta_boxes[0] ); if ( isset( $_POST[‘my_dates_post_ID’] ) … Read more

From admin edit user page query either the user_nicename or username field value of the user profile being edited or viewed

To get the username of a user you can use the get_userdata() function. Pass it the users ID $user = get_userdata($user_id); Then the have access to the username or user_login as its called echo $user->user_login; You can read more about this function here: https://codex.wordpress.org/Function_Reference/get_userdata Or if you need to get the user by other information, … Read more

Permanently show Custom Fields in Editor

this should work but you overwrite the values for existing objects. to add default values only for new objects try that : $postType = “tender”; add_action( ‘save_post_’ . $postType, function ($post_ID, \WP_Post $tender, $update) { if (!$update) { // default value for new object // Add the meta data you want the custom post type … Read more

Sort columns in the ‘Pages’ dashboard overview

I just realized that there was a typo in the code. The meta-tag should read ‘prod_hierar’ instead of ‘prod-hier’. This fixes the issue. (Too much experimenting, I guess ..). Function ‘wms_hierarchy_col_orderby()‘ thus becomes: function wms_hierarchy_col_orderby( $vars ) { if ( isset( $vars[‘orderby’] ) && ‘prod_hierar’ == $vars[‘orderby’] ) { $vars = array_merge( $vars, array( ‘meta_key’ … Read more