• Hi all, I use this function in my code to list the authors on my site, and their respective rss feeds..

    https://codex.www.ads-software.com/Template_Tags/wp_list_authors

    But I don’t want ALL users listed – only the writers of the site – we also let the public write for the site but I dont want them to appear in the list – how can I restrict this list by role – the only parameter for exclusion appears to be exclude_admin.

    Any help massively appreciated!

    Cheers

    Will

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter willgoldstone

    (@willgoldstone)

    Hi all – i’ve now realised i’ll probably have to edit one of the includes to get this feature – a file called author-template.php.

    on line 448 you’ll see

    $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name");

    But I want to get rid of other types of users by excluding not simply the admin, but ‘public’ user types also. I’ve tried altering that line to this –

    $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' AND 'public " : '') . "ORDER BY display_name");

    and I also tried this –

    $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'public' " : '') . "ORDER BY display_name");

    and this –

    $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login == 'public' " : '') . "ORDER BY display_name");

    None of which has worked so far. HELP!

    Will

    Hi Will, maybe the List Authors Plus plugin will help https://www.ads-software.com/extend/plugins/list-authors-plus/

    I was looking for something similar. That plugin looks perfect for me. Thanks Lynette!

    Will. I had done what you did previously by editing the author template file. But everytime I upgraded, it would mess me up and I would have to do it again. So I would recommend trying to use a plugin. Editing core files is such a last resort.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘List Authors, but not certain roles.’ is closed to new replies.