Skip to main content

How to Add a Chat Room to Your WordPress Site (2026 Guide)

· 15 min read
Creator of Better Messages

A chat room is a single persistent conversation that any number of people can join, leave, and come back to — unlike a private message, which is bound to a specific pair of users. On a WordPress site, a chat room is the right tool for live event lobbies, course cohorts, paid-membership lounges, support rooms, vendor operations channels, and any case where you want one URL where people congregate in real time.

WordPress chat room — multi-participant conversation with online users sidebar embedded on a WordPress page

This guide is the long-form reference for chat rooms in WordPress: the fastest path to a working room, every per-room setting and what it does, the use-case recipes that combine those settings, how voice/video calls fit in, how to keep big rooms healthy, and when a chat room is the wrong answer.

The fastest path: a single shortcode or a Gutenberg block#

With Better Messages installed, every chat room is a WordPress custom post type — you create one in the admin and embed it anywhere with either a shortcode or a Gutenberg block. The whole setup takes about five minutes.

  1. Install Better Messages from WordPress.org and activate it.
  2. Open WP Admin → Better Messages → Chat Rooms → Add New.
  3. Give the room a name (for example, Members Lounge).
  4. Pick which user roles are allowed to join.
  5. Optionally enable Guest access to let unregistered visitors participate.
  6. Tune the per-room settings (covered in detail below) — most rooms are fine with defaults.
  7. Publish.
  8. Embed the room on any page or post using one of two methods:

Shortcode method — works in any editor or page builder that accepts shortcodes:

[better_messages_chat_room id="123"]

The shortcode also accepts a full_screen="1" attribute that opens the room in full-screen mode on desktop.

Gutenberg block method — open the block inserter, search for Better Messages — Chat Room, drop the block onto the page, and pick the room from the dropdown. There is a checkbox for Auto open full screen in desktop mode if you want the room to take over the viewport.

That is the whole setup. The page now renders a full chat room — message history, file uploads, reactions, mentions, an online-users sidebar, the works.

Per-room settings: every lever, what it actually does#

A new chat room ships with sensible defaults. Most sites only need to set the Allowed roles and Guest access toggles and move on. But the room has more levers than that, and knowing what each one does is the difference between a room that runs itself and a room you have to babysit.

SettingWhat it controls
Allowed user rolesWhich WordPress roles see the join button. Users outside the list see a "join not permitted" message.
Allow guestsWhen on, unregistered visitors can join after entering a display name. Guests are stored in the plugin's own table with negative user IDs and persist across visits on the same browser.
Auto joinAnyone who visits the page hosting the shortcode and meets the role requirements is silently added to the room. Best for rooms where the act of viewing the page is the act of joining (course cohorts, paid membership lounges).
Auto add by rolePick specific roles and every existing user (and new account from then on) with that role is auto-added to the room. Useful for "all customers join the customer lounge" patterns.
Auto excludeThe opposite of Auto add — when a user's role no longer matches the allowed roles, they are automatically removed from the room on the next sync. Useful when role membership is tied to subscription status.
Only joined can readIf on, the message history is hidden from anyone who has not joined the room. If off, users can read along before deciding to join. Useful for paid-content rooms where the lurker view should be locked down.
Enable file uploadsWhen off, the paperclip icon disappears for this room. Use it on rooms where files would be off-topic or a moderation burden.
Enable notificationsWhen on, the room counts toward unread badges in the user's main thread list. When off, the room is "quiet" — users see new messages only when they have the room open.
Enable email notificationsWhen on, participants receive an email digest for unread messages they did not see in-session.
Show online usersToggles the right-side sidebar that lists currently online participants in the room.
Hide participants / Hide participants countTwo privacy toggles — hide the full participant list, or just hide the count. Useful for rooms where you don't want users sizing up the audience.
Hide from thread listThe room never appears in the user's main conversation list. Combined with Enable notifications off, this makes a "background" room that users only see when they open the page hosting the shortcode.
System messagesControls the "Alice joined", "Bob left" notices and their per-type granularity.
Auto-remove inactive usersPeriodically prunes participants who have stopped engaging. Covered in its own section below.

The combinations are what matter — see the recipes section below.

Access control: who can join#

The two top-line levers — Allowed user roles and Guest access — cover almost every real case:

  • Allowed user roles restricts the room to subscribers, members, customers, students, instructors, vendors, or any custom role.
  • Guest access is optional. When on, unregistered visitors can join the chat after typing a display name. Each guest is stored in the plugin's own table and gets a negative-ID identity, so guest history is preserved across visits on the same browser without requiring a WordPress account.

The plugin treats guests as first-class participants — they can send messages, upload files (if you allow it), use reactions, mention other people, and receive @-mention notifications. The only restriction is that they cannot start a video or audio call (call buttons are hidden for guests).

Use-case recipes#

A chat room is a stack of toggles. Here are the combinations that match common patterns:

Public live-event lobby#

A room people drop into the day of a webinar or stream. They show up, talk, leave when the event ends.

  • Allowed roles: all
  • Allow guests: on
  • Auto join: on (everyone who hits the page becomes a participant)
  • Enable notifications: off (you don't want the lobby pinging participants for days)
  • Auto-remove inactive: on, scoped to Guests only, threshold 7 days

Members-only lounge#

A persistent room for paid members or subscribers — the social part of a membership site.

  • Allowed roles: members / subscribers
  • Allow guests: off
  • Auto add by role: same roles as Allowed (so new members are added automatically)
  • Only joined can read: on
  • Auto-remove inactive: off (silent members are fine — they may rejoin later)

One room per course, scoped to students enrolled in that course plus the instructor.

  • Allowed roles: students + instructors
  • Allow guests: off
  • Auto join: on (anyone with the enrolled role who visits the lesson page becomes a member)
  • Enable file uploads: on (students submit assignments / share notes)
  • Auto-remove inactive: scoped to students, threshold matching the course length

Public support room#

Anyone — including guests — can come in and ask a question. Useful for SaaS-style sites where logged-out visitors need help before signing up.

  • Allowed roles: all
  • Allow guests: on
  • Auto-remove inactive: scoped to Guests, threshold 14 days (keeps the participant list clean without losing customer history)

Vendor operations room#

For marketplace sites (Dokan, WCFM, WC Vendors) — a private channel for verified vendors plus marketplace admin.

  • Allowed roles: vendor + administrator
  • Allow guests: off
  • Auto add by role: vendor (new vendors join automatically)
  • Auto exclude: on (vendors whose role gets revoked are removed)
  • Hide from thread list: on (vendors only see the room when they open the operations page)
  • Auto-remove inactive: off

Background announcements room#

A "quiet" room that admins post into — participants see it only when they open the page, not in their notification badges.

  • Allowed roles: all
  • Allow guests: off
  • Auto join: on
  • Enable notifications: off
  • Hide from thread list: on

Real-time delivery: free version vs WebSocket version#

A chat room only feels like a chat room if new messages arrive within a second or two. Better Messages ships two delivery modes:

  • Free version (AJAX) — the page polls the server every few seconds. Good enough for low-traffic rooms with a handful of active participants. Server cost grows with the number of open tabs.
  • WebSocket version — a persistent connection delivers messages instantly. The hosted relay is included in the license, so you do not run your own server. Required for voice and video calls inside the chat room.
info

If you expect more than ~20 simultaneously active participants in a single room, go straight to the WebSocket version. The polling load on a busy room outweighs the license cost quickly, and the difference between "a new message every 3 seconds" and "instant" is visible the moment more than a handful of people are typing.

Voice and video calls inside the chat room#

With the WebSocket version, the chat room's header shows call buttons — one for audio, one for video — that start a group call any participant can join. The call window is in-page (no popup, no second tab), so participants stay in the room while the call happens. Cap is 32 participants for video, 50 for audio.

This turns the chat room into a meeting space: a course cohort can drop into a group call during office hours, a vendor operations room can do a daily standup, a paid lounge can host happy hour. The chat history persists either way — the call is just a layer on top of the same persistent room.

Calls require the WebSocket version. With the free version, the call buttons are hidden.

Keeping big rooms healthy: auto-remove inactive#

A chat room with 500 silent members and 5 active ones feels dead. The participant list looks like activity but isn't, and notification fan-out treats lurkers as people who care.

Each room has an Auto-remove inactive users option with three signals you can pick from:

  • Has not visited the site for N days — catches abandoned accounts. Uses the user's last authenticated request anywhere on the site.
  • Has not sent a message in this room for N days — catches lurkers who are active site-wide but never participate here.
  • Has not opened this room for N days — catches uninterested participants. Keys off the user's last visit to this specific room.

You can scope the cleanup to specific roles. The role list shows every editable WordPress role plus a synthetic Guests entry for unauthenticated visitors. Leave everything unchecked to keep the original "remove anyone" behavior; the most common case is ticking only Guests so silent guest visitors get pruned but registered members are left alone.

Two safety nets are built in:

  • Every participant gets a grace period equal to the inactivity threshold. A user who was just added — by clicking Join, by an admin invitation, or via Auto join — will not be purged until they have been a member for that many days. New joiners are never deleted on the next cron run.
  • AI chat bots are skipped automatically and never auto-removed.

If a removed user later visits the page hosting the chat shortcode and Auto join is on, they will be auto-joined again. That round trip is intentional — prune dormant, restore active.

Pin specific users#

To prevent specific users (admins, room owners, guests of honor) from ever being auto-removed, drop the following into your theme's functions.php or a custom plugin:

add_filter( 'better_messages_clean_inactive_chat_users_exclude_user_ids', function( $ids ) {
return array( 1, 42, 7 );
} );

Tune the cleanup batch size#

The job processes up to 100 inactive participants per chat room per cron tick. Raise it on sites with very large rooms, lower it on shared hosting:

add_filter( 'better_messages_clean_inactive_chat_users_batch_size', function() {
return 500;
} );

Setting the batch size to 0 disables the cleanup job entirely.

Picking a chat-room approach for WordPress#

A few patterns sites use for chat-room functionality on WordPress:

  • A chat-room plugin (such as Better Messages) — the conversation lives on the site, gated by WordPress roles, tied to user accounts, ownable and exportable.
  • Embed a third-party service (Discord, Tawk, Crisp, embedded chat widgets) — the chat lives off-site, the site cannot read it, members may need a separate account, and the conversation is the third party's data.
  • Comments — pseudo-chat, but page-refresh based and threaded in a way that does not feel like a chat room.
  • Roll your own — a non-trivial engineering project involving a WebSocket server, persistence layer, moderation tooling, and a mobile client.

For the on-site, role-gated, account-tied pattern, a chat-room plugin like Better Messages is the right tool. It is the only path that keeps the conversation inside the site, tied to WordPress user accounts and roles, and exportable as data you own.

Chat room vs group conversation: pick the right tool#

These are easy to confuse:

  • A chat room is a single persistent space embedded on a URL. Anyone who meets the access rules can join and leave on their own.
  • A group conversation is a thread started by one user who invites a specific set of other users — like a group DM in Slack or iMessage.

Use a chat room when there is one place people congregate and the participant list is dynamic. Use a group conversation when a specific set of people need to talk about a specific topic and the thread doesn't need a permanent URL.

Mobile and accessibility#

Chat rooms render full-width on phones, with the online-users sidebar collapsing into a toggle. The native iOS and Android apps support chat rooms the same way they support any other thread — participants get push notifications when someone messages a room they have joined. Keyboard navigation, screen-reader labels, and focus management follow WordPress accessibility conventions.

When a chat room is the wrong answer#

A chat room is the right tool when there is one shared space everyone joins. If you need:

  • Private one-on-one conversations between two users — use private messages, not a chat room.
  • A separate thread per topic — use group conversations created on demand, not a single persistent room. Forums (bbPress, BuddyPress activity, BuddyBoss) are also worth considering for long-form topic-threaded discussion.
  • A live event lobby that ends when the event ends — a chat room with an expiration date is fine, but consider whether the conversation should survive the event. If it shouldn't, deactivate the room (set the post to draft) once the event is over.

Frequently asked questions#

Can I embed the chat room inside a page builder like Elementor?#

Yes — the shortcode works in any builder that accepts WordPress shortcodes (Elementor, Bricks, Oxygen, Beaver Builder, the block editor's Shortcode block). The Gutenberg block works natively in the block editor and any builder that supports Gutenberg blocks.

Can a single room have voice or video calls?#

With the WebSocket version, yes — group voice and video calls work inside the chat room. The cap is 32 participants for video and 50 for audio. With the free version, the call buttons are hidden.

Can guests in a chat room upload files?#

Yes, if you allow it. Guest permissions are configured per chat room and again globally under Better Messages → Settings → Guest Chat.

How many participants can a chat room have?#

There is no hard limit. The plugin has been used with rooms of several thousand members. Past a few hundred actively-typing participants, the WebSocket version's instant delivery becomes meaningful — and Auto-remove inactive becomes essential.

Will the chat room be indexed by Google?#

The container page is indexable, but the messages themselves load via REST API and are not in the initial HTML, so Google does not index message content. This is usually the desired behavior — chat room conversations are ephemeral, not canonical content.

Can I have more than one chat room on the same page?#

Yes — drop multiple shortcodes or blocks on the page, each with a different id. The plugin renders them independently with separate participant lists, online sidebars, and unread counts.

Can I customize the chat room's appearance?#

The room inherits the site's CSS variables for colors, fonts, and spacing. For deeper customization, every UI region has a stable CSS class — restyle via the theme's stylesheet or a child theme. The per-room Modern layout setting controls whether the conversation list sits on the left, right, or expands to the full width.

Does the chat room work with caching plugins?#

Yes. The container HTML is cached normally; messages load via REST API at runtime, so a full-page cache does not stale the conversation. The plugin is tested against Autoptimize, LiteSpeed Cache, W3 Total Cache, WP-Optimize, and WP Fastest Cache.

Can administrators read every chat room conversation?#

Yes — admins have access to every room and every message via WP Admin → Better Messages → Chats. The same admin page is where you moderate messages, mute participants, or remove users from a room.

See also#

Install Better Messages from WordPress.org →