how to create user profile pages and display them based on users roles

Try this to get you started. This creates a shortcode [alldevelopers] that displays a list of all developers. Pretty basic but can be heavily extended and duplicted. (Not tested) add_shortcode( ‘alldevelopers’, ‘show_all_developers’ ); function show_all_developers(){ $users = get_users( [ ‘role__in’ => [ ‘developers’ ] ] ); foreach ( $users as $user ) { echo $user->first_name … Read more

How to restrict subscriber editing other posts but read specific posts in backend

To query posts with more than one author ID, you can use author__in parameter. This makes posts from chosen authors visible (read only) for the current user. add_filter(‘pre_get_posts’, ‘posts_for_current_author’); function posts_for_current_author($query) { if ( $query->is_admin && ‘edit.php’ === $GLOBALS[‘pagenow’] && ! current_user_can( ‘edit_others_posts’ ) ) { $query->set(‘author__in’, array(get_current_user_id(), 1, 2, 3) ); // add 1 … Read more

How to display total user count by specific role in WordPress as statistics?

insert this code in your theme functions.php and use this shortcode [users_count_bro] to display where you want function total_count_bro() { $out=””; $user_count_data = count_users(); $avail_roles = $user_count_data[‘avail_roles’]; foreach ( $avail_roles as $role_key => $role_count ) { $out .= $role_key.’:’.$role_count.'<br/>’; } return $out; } add_shortcode( ‘users_count_bro’, ‘total_count_bro’ );

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)