Usermeta data unserialize, extract and display in table in WordPress
Usermeta data unserialize, extract and display in table in WordPress
Usermeta data unserialize, extract and display in table in WordPress
Why is my Custom User Meta deleted on Profile Update?
In this case you issue your ID while you have to look for the “name” or “value”. if( isset( $_POST[‘user_activities-‘.$useractivitie->slug] ) ) Change to: if( isset( $_POST[‘user_activities’][$useractivitie] ) )
check metadata in wordpress
I manage to filter the posts, this seems to be enough for this project function remove_notallowed_authors( $query ) { $user = wp_get_current_user(); if ( in_array( ‘editor_group_role’, (array) $user->roles ) ) { $user_ids = get_users( [ ‘role’ => ‘user_role_that_posted’, ‘fields’ => ‘ID’ ] ); $query->set( ‘author__in’, $user_ids ); } } add_action( ‘pre_get_posts’, ‘remove_notallowed_authors’ );
Delete user meta ( delete_user_meta ) by key without user id
function get_users_email ($time_zone_cont, $class_group){ // Add Lisa’s user id, 14, in an array. $exclude_list = array( ); $Time_Zone = $time_zone_cont; $user_class_group = $class_group; $args = array( // ‘role’ => ‘Editor’, // ‘exclude’ => $exclude_list, ‘meta_query’ => array( // ‘relation’ => ‘OR’, array( ‘key’ => ‘Time_Zone’, ‘value’ => $Time_Zone, ‘compare’ => ‘=’ ), array( ‘key’ => … Read more
That was a tricky one. For the user meta update to happen only on first name update you will need the following. Create a constant that will contain the current user first name Check to see if the current user first name is different from the submitted user name on profile update For the constant … Read more
You can use insert_user_meta($user_id,’meta_key’,’meta_value’); when you want to get that keys, you can get like $keys = get_user_meta($user_id,’meta_key’); in $keys variable you get an array of all keys.
WordPress has wp_get_current_user() function for getting the current (logged in) user, which you could use. If the returned WP_User object doesn’t have all the details you need, you can get either all or a specific user meta with get_user_meta(). For getting the user’s avatar, you could use get_avatar(). Have a look at the function docs … Read more