Super Plugin Sale! Your Choice: BOGO or 30% Off »
Web Dev + WordPress + Security

WordPress Plugin: Simple Ajax Chat

[ Simple Ajax Chat ] Simple Ajax Chat displays a fully customizable Ajax-powered chat box anywhere on your site. SAC makes it easy for your visitors to chat with each other on your website. There already are a number of decent chat plugins, but I wanted one that is simple yet fully customizable with all the features AND outputs clean HTML markup for easy styling.

Go Pro! Create unlimited chat forms with more features. Check out SAC Pro »

Simple Ajax Chat is based on Jalenack’s Wordspew (aka AJAX Shoutbox), which I’ve been using on my sites since the plugin was released back in 2005 (ish). Wordspew works great even today, but it hasn’t been updated in seven years, so I decided to adopt and improve the plugin with fresh code, clean markup, better control, and more features. Here’s a screenshot showing the plugin used for an imaginary, rather egocentric chat:

[ Simple Ajax Chat: Chat Box ]
Screenshot of chat-box display (view more screenshots)


Simple Ajax Chat uses Ajax to enable new chats to appear without refreshing the page. The form works great even without JavaScript, but the page is refreshed for each new message. Here is an overview of the plugin’s main features:

  • Plug-n-play functionality, no configuration required
  • Display on any post or page with the shortcode
  • Display anywhere in your theme template with the template tag
  • Includes default CSS styles and enables custom CSS from the settings
  • JavaScript/Ajax goodness loads new chats without refreshing the page
  • Also works when JavaScript is not available on the user’s browser
  • Clean markup makes it easy to style the appearance as you please
  • New chat messages fade-in with custom duration and color
  • Includes manage-chats panel for editing and deleting chats
  • Links included in chats include `_blank` target attributes
  • Includes complete map of all available CSS hooks
  • Includes built-in banned-phrases list
  • Automatic smileys supported :)
  • On-demand restoration of all default settings
  • Super-slick toggling settings page

One of my favorite new features is the built-in chat blacklist, where you can add any phrase from the settings page and have it magically disappear from the username, chat input, or URL (if enabled). With the old plugin, I had to modify the source code to block stuff, but now it’s all handled from the comfort of the WP Admin.

Customize everything

The Wordspew plugin included a minimal set of options, which is one of the reasons I found it so useful. So I wanted to keep that simplicity while adding some much-needed features. It’s a balance that I think stays true to the original. Here’s a list of things you can customize with Simple Ajax Chat:

  • Customize the update interval for the Ajax-requests
  • Customize the fade-duration for new chat messages
  • Customize the intro and outro colors for new chats
  • Option to require login/registration to participate
  • Option to enable/disable URL field for usernames
  • Option to use textarea for larger input field
  • Customize the default message and admin name
  • Customize the appearance with your own CSS
  • Option to enable/disable custom styles
  • Option to load the JavaScript only when the chat box is displayed
  • Add custom content to the chat box and chat form
  • Built-in control panel to edit and delete chats
  • Built-in blacklist to ban specific phrases from the chat

Installation & Usage

Activate the plugin and visit the SAC settings page to customize your options. Once everything is customized as you like it, display the form anywhere using the shortcode or template tag.

Shortcode & Template Tag

Use this shortcode to display the chat box on a post or page:


Use this template tag to display the chat box anywhere in your theme template:

<?php if (function_exists('simple_ajax_chat')) simple_ajax_chat(); ?>


Here are some screenshots of Simple Ajax Chat in action (using default settings):


Online demo available at WP-Mix: Simple Ajax Chat DEMO »


Download Simple Ajax Chat via the Plugin Directory:

About the Author
Jeff Starr = Designer. Developer. Producer. Writer. Editor. Etc.
USP Pro: Unlimited front-end forms for user-submitted posts and more.

70 responses to “WordPress Plugin: Simple Ajax Chat”

  1. Hi Jeff, my comment from yesterday has disappeared…

    Anyway, I’ve been looking why when I press Enter, the message is not sent. I checked your code:

    function pressedEnter(field,event){
    var theCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
    if (theCode == 13) {
    return false;
    else return true;

    And the thread you refer to:

    Maybe it has something to do with that. The code is from 2005, maybe now it could need some change?

    Since I don’t know how to code, I’m just suggesting, if it is of any help… Thanks! :)

  2. Yes, sac.php is loaded!

    ‘Enter’ doesn’t work on FF nor on IE.

    Hope that helps (see my previous comment, published after your reply).

    • Jeff Starr 2013/03/07 5:26 pm

      Yes it does. I just checked the demo (linked in previous comment) in the following browsers:

      PC / IE 8
      PC / Firefox 3.6.25
      Mac / Firefox 17.01

      It sounds like something else is interfering with normal functionality, which you can easily verify on a new/default installation of WP. I’ve actually tested the plugin in many other browsers as well, and they all seem to work great.

  3. I’m sure your plugin works fine on a new/default installation of WP (I asked a friend to check and it does), unfortunately, I’ve installed your plugin on a working WP site so I guess something is indeed interfering with normal functionality…

    Don’t you have any idea what could cause the keycode not to work? Could it come from the CSS I modified? I’m stuck here, your plugin is so simple it’s great, if only the Enter key would work…

    Thanks for your great work on this plugin and your help, much appreciated!

    • Don’t you have any idea what could cause the keycode not to work?

      Sure, I have lots of ideas, but with a family of four, a mortgage, 80+ hour work week, and a life to live, my time for pro bono is limited.

      Off the top of my head, I would try disabling all other plugins and seeing if that helps. Then I would do some tests to ensure that the JavaScript is working, and then after checking anything else that I could find, would set up a test install of WordPress and build things up until the point of failure is discovered.

      Or I would just move on and find another plugin ;)

  4. I have alot of spammers (posting random stuff) is there something i can do about that? or maybe add a rule that they must match a number>? 3 + 4 = ?

    • Jeff Starr 2013/04/10 1:03 pm

      A good way of stopping spammers is to require login to chat. An alternate solution is to blacklist key terms via the plugin settings.

  5. Hi Jeff, great thank you, i tried several chat plugins but this one worked in 2 seconds, big smile anne

  6. Hi Jeff, when I send a message my browser refreshing the page , what can cause this bug ?

  7. Is there a way to make more than one chat room on a single website

  8. is there a way to show who is online in the chat?

  9. Please can we auto delete after some minutes all the chats?

  10. Another question ! It’s possible the persons don’t write anything or forgot to put the name , but the chat don’t show error?

    • Jeff Starr 2013/07/03 3:05 pm

      Only by using the plugin settings, some aspects of this are possible, but you may also customize with code according to your specific needs.

  11. first of all thanks for the answer, just another thing, what I have do change in the code you show to change from delete the chat in one hour to for example 3 minutes, or 180 seconds?

Comments are closed for this post. Something to add? Let me know.
Perishable Press is operated by Jeff Starr, a professional web developer and book author with two decades of experience. Here you will find posts about web development, WordPress, security, and more »
Blackhole Pro: Trap bad bots in a virtual black hole.
All free plugins updated and ready for WordPress 6.6 dropping next week. Pro plugin updates in the works :)
99% of video thumbnail/previews are pure cringe. Goofy faces = Clickbait.
Crazy that we’re almost halfway thru 2024.
I live right next door to the absolute loudest car in town. And the owner loves to drive it.
8G Firewall now out of beta testing, ready for use on production sites.
It's all about that ad revenue baby.
Get news, updates, deals & tips via email.
Email kept private. Easy unsubscribe anytime.