WP-UserOnline source code
By Lester Chan, on WordPress.org since 2006. 10,000+ active installs.
WP-UserOnline shows how many people are on your site right now, and where they are. Members are named, guests and search bots are counted, and the whole thing refreshes itself in the background without a page reload. Below is its source code for every one of its 47 releases, what changed in the latest one, and how often it ships.
What changed in 4.0.2
Released Sep 1, 2026, 1 week after 4.0.1- NEW: A wp_useronline_needs_scripts filter, for code that renders the counters where WP-UserOnline cannot see it coming. The refresh script loads only when something on the page has rendered a counter or a listing, and it is enqueued from wp_footer — the one pass. Markup fetched over admin-ajax.php or the REST API into a page that shows none of its own reaches neither, so its numbers never refreshed. Returning true from the filter is how such a page asks for the script.
- CHANGED: WP_UserOnline_Template::needs_script() and request_script() are now needs_scripts() and request_scripts(), plural, matching every other name the plugin uses for its front end assets. Neither was ever documented, but they are public, so a theme or plugin calling one by name needs the s.
7 files changed since 4.0.1: 7 modified, 0 added, 0 removed.
- includes/class-wp-useronline-template.php modified, +7 bytes
- includes/class-wp-useronline-widget.php modified, +1 bytes
- includes/class-wp-useronline.php modified, +1,248 bytes
- js/wp-useronline-admin.js modified, -142 bytes
- js/wp-useronline.js modified, -671 bytes
- readme.txt modified, +1,555 bytes
- wp-useronline.php modified, same size
Release history
47 releases since March 2007- 4.0.2 Sep 1, 2026 NEW: A wp_useronline_needs_scripts filter, for code that renders the counters where WP-UserOnline cannot see it coming. The refresh script loads only when something on the page has rendered a counter or a listing, and it is enqueued from wp_footer — the one pass. Markup fetched over admin-ajax.php or the REST API into a page that shows none of its own reaches neither, so its numbers never refreshed. Returning true from the filter is how such a page asks for the script.
- 4.0.1 Aug 24, 2026 NEW: A Settings link on the plugin’s row of the Plugins screen, opening the Users Online screen’s Settings tab.
- 4.0.0 Aug 10, 2026 FIXED: A recorded location could be a protocol-relative URL, which is an absolute one wearing a path’s clothes. https://example.com//evil.com/ parses with this site’s host, passed the host check, was stored as //evil.com/, and came out of esc_url() untouched — so the public listing carried a link to somebody else’s site. Leading slashes now collapse to one, on the submitted URL and on REQUEST_URI alike
- 3.0.0 Jul 26, 2026
- 2.88.9 Jan 11, 2025