getButterfly Logo

ChatPress is a simple chat plugin for WordPress members. Use it by placing shortcodes with user ID and call to action parameters in a post, page or widget.

[chat-with id="36149"]

[chat-with id="1" message="Initiate chat with"]

[chat-with id="1" message="Live chat support with"]

Download the chat script as a WordPress plugin below:

ChatPress Sample WindowThis is a simple WordPress plugin to add a real-time chat system for your registered users. It works with all roles, including subscribers, editors, contributors and custom created ones.

For a chat system you would need a heartbeat script, to check interactions every X seconds and an AJAX container to display them, based on user ID. Pretty simple so far.

I used a modified version of an old Anant Garg’s script for this, with localized AJAX variables for WordPress and improved browser support. There are no options for this script, unless you want to customize the chat boxes, although this is achievable from the CSS stylesheet.

The structure of the plugin is the following:


The engine of this script lies in the chat.php file and the chat.js file.

The remaining files are the required plugin modules to integrate with WordPress.

The plugin is extendable, and it can be built upon. It uses a separate database table to store user IDs and chat contents. All chat sessions are hidden in the database and they are not visible to other users. The plugin can be adapted into a real-time private messaging module, by placing the shortcode inside a PHP template, a theme or a plugin.

When including the chat link into a plugin, the following line should be used:

<a href="javascript:void(0)" onclick="javascript:chatWith('<?php echo $user_login; ?>')">Chat</a>

The link above will open a chat window with the selected user. Note that the call to action can be customized to include any phrase.

The WordPress chat plugin settings can be found inside Settings -> ChatPress and includes an on/off switch and colour options.

Chat dashboard Chat settings

= 2.0.0 =
* FIX: Fixed WordPress native styles
* FIX: Fixed all official links
* FIX: Fixed a typo
* FIX: Fixed table generation not taking into account the database prefix
* FIX: Removed an unused global variable
* UPDATE: Added `utf8mb4` database update
* UPDATE: Added option autoloading for better performance
* UPDATE: Added uninstallation routine (delete all tables and options)
* UPDATE: Updated FontAwesome URL
* UPDATE: Updated CSS styles for latest browsers

= 1.0.0 =
* First release