1. Home
  2. Docs
  3. Subscribe2
  4. Hooks, API & Customization
  5. s2_authors

s2_authors

This hook allows the display list of content authors to be refined. For example, old and unused author accounts can be removed from the list without the need to delete the user account.

function remove_author($authors) {
    // our function takes an array of author objects as the input
    // you can then cycle through the array and remove any that you like on either 'ID' or 'display_name'
    $i = 0;
    foreach ( $authors as $author ) {
        // example use an if statement to check if author ID should be removed compared to a known ID
        if ( $author->ID == 1 ) {
            unset($authors[$i]);
        }
        $i++;
    }
    return $authors;
}
add_filter('s2_authors', 'remove_author');
Was this article helpful to you? Yes No

How can we help?