Skip to content

Let a site switch off the online filter and count on Users #727

Closed

Description

@josephfusco

Users gets an Online view with a live count. A site that doesn't want it can't remove it without code.

How

#724 adds the switch and does post locks end to end; copy it. Start once it merges.

  1. Add an entry to wp_presence_get_features() in includes/features.php: key user-list, a label and a one-sentence description of what switching it off removes.
  2. In includes/default-filters.php, wrap the hooks below in if ( wp_presence_feature_enabled( 'user-list' ) ) { … } with the same "Plugin only" comment the post-locks block has. Leave every file loaded; only the hooks are gated.
  3. Add tests to tests/test-features.php, following test_switching_post_locks_off_leaves_their_hooks_unregistered(): with the switch off none of these hooks are registered, and with it on each is back at its priority.
  4. Mention the switch in the README section for the piece.

Hooks to gate

Hook Callback Priority
views_users wp_presence_users_views 10
pre_get_users wp_presence_filter_online_users 10
heartbeat_received wp_presence_users_list_heartbeat_received 13
heartbeat_received wp_presence_users_online_count_heartbeat_received 13

The network Users screen has its own hooks in ms-default-filters.php; those belong to the network admin switch, not this one.

How we will know it is done

Unchecking Users list on Settings > Presence API removes the piece on the next page load, checking it brings it back, and the suite passes:

npm test

Part of #710.

Activity

  1. added
    [Type] Enhancement
    [Area] Admin UI
    Good First Issue
    on Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good First Issue[Area] Admin UI[Type] Enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions