Uncaught Error: Call to undefined function wp_get_current_user() in

My simple plugin gives error: // Class wpb_widget ends here add_action(‘init’,’do_stuff’); function TopAuthor() { $contributor_ids = get_users( array( ‘fields’ => ‘ID’, ‘orderby’ => ‘post_count’, ‘order’ => ‘DESC’, ‘who’ => ‘authors’, ) ); foreach ( $contributor_ids as $contributor_id ) : $post_count = count_user_posts( $contributor_id ); // Move on if user has not published a post (yet).…

Details