M
M
Max Brilliant2021-08-30 15:01:14
WordPress
Max Brilliant, 2021-08-30 15:01:14

How to get a list of all wordpress managers?

Hello. Please help with wordpress. I need to implement something like this. There are, for example, "Manager" users, you need to get a list of managers from the user's side, select the user's manager and save. Everything can be done in the user section, but how. Tell me please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Zolin, 2021-08-30
@artzolin

$args = array(
  'role'   => 'administrator',
);

if ( $users = get_users( $args ) ) {
  echo '<ul>';
  foreach ( $users as $key => $user ) {
    echo '<li><a href="' . get_author_posts_url( $user->ID ) . '">' . $user->display_name . '</a></li>';
  }
  echo '</ul>';
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question