Skip to content
RetroChat

WordPress

How to Add Live Chat to WordPress (Plugin or Code)

Add a chat widget to your WordPress site the safe way, with a plugin or with embed code that survives theme updates, then test it before visitors see it.

By the RetroChat team · · 6 min read

There are two ways to add live chat to WordPress. The easiest is to install your chat tool's WordPress plugin, activate it and paste in your account key. The alternative is to paste the chat tool's embed code into your site's footer, either with a code snippets plugin or in a child theme, so it loads on every page and survives theme updates. Either way, it takes a few minutes; the rest of this guide shows you how to do it safely and test it properly.

Before you start

You'll need:

  • Admin access to your WordPress dashboard.
  • An account with a live chat tool, and either its plugin or its embed code.
  • Your site's domains listed in the chat tool if it restricts where the widget can load (a good security feature). Include your staging domain if you test there first.

If your site is on WordPress.com rather than self-hosted WordPress, whether you can install plugins or add custom code depends on your plan, so check that first.

A plugin is the simplest and safest method for most sites. It keeps your theme files untouched, and updates arrive through the WordPress dashboard like any other plugin.

Step-by-step

  1. Get the plugin. Either search for it under Plugins → Add New Plugin, or download the plugin's zip file from your chat provider.
  2. Upload it if needed. Go to Plugins → Add New Plugin → Upload Plugin, choose the zip file and click Install Now.
  3. Activate the plugin.
  4. Connect your account. Open the plugin's settings page and paste the key or ID from your chat tool's dashboard.
  5. Save, then open your site in a private browser window to check that the chat launcher appears.

What to look for in a WordPress chat plugin

  • Updates delivered through the WordPress dashboard.
  • A way to hide the chat on specific pages (checkout or landing pages, for example).
  • An option to hide it for logged-in administrators, so it doesn't get in your way while you edit.
  • Asynchronous loading in the footer, so the chat script doesn't hold up your page.
  • Optional, secure identification of logged-in users (members or customers), so they don't need to introduce themselves.
  • A shortcode or block to add a "Chat with us" button inside your content.

If you'd rather not add a plugin for chat, you can paste the tool's embed code so it loads before the closing </body> tag on every page. There are a few ways to do that, and one way to avoid.

Avoid: editing your theme's files directly

Pasting code into your active theme's footer.php or functions.php through Appearance → Theme File Editor works, until the theme updates. WordPress's own developer documentation warns that if you modify a parent theme directly, your changes will disappear the next time the theme is updated. It's also easy to break your site with a typo in functions.php.

Many lightweight plugins exist purely to insert code into your site's header or footer. Install one, find its footer box (sometimes labeled "before </body>"), paste your chat embed code, and save. This is the best code route for non-developers.

Option B: A child theme

If you already use a child theme, add a small function to its functions.php that prints your embed code in the footer:

add_action( 'wp_footer', function () {
    ?>
    <!-- Paste your chat tool's embed code here -->
    <?php
} );

The wp_footer hook runs just before the closing </body> tag in standard themes, so the chat loads on every page. Because the code lives in the child theme, updating the parent theme won't remove it.

Which method should you choose?

Plugin Snippets plugin Child theme
Skill needed None Low Comfortable with PHP
Survives theme updates Yes Yes Yes
Hide on chosen pages Usually built in Depends on the plugin Custom code
Updates From the dashboard Update the code by hand Update the code by hand
Best for Most sites Sites avoiding a chat-specific plugin Developer-managed sites

Test before visitors see it

Run through this checklist after installing with either method:

  • The launcher appears in a private window (logged out).
  • It appears on mobile and doesn't cover your menu, cart or cookie banner.
  • It's hidden where you want it hidden (for example, checkout).
  • A test message arrives in your chat inbox in real time.
  • Outside office hours, the widget asks for an email and your team is notified.
  • Your caching plugin isn't serving a stale page without the widget. Clear the cache after installing.
  • If you identify logged-in users, your cache doesn't cache pages for logged-in users (the default in most popular caching plugins).

Make the chat feel like part of your site

Once it's working, spend ten minutes on the details that make visitors trust it:

  • Match your brand color and choose the launcher position (bottom right is the convention).
  • Write a specific greeting. "Questions about our plans? Ask here." beats "How can I help you?" See our chatbot welcome message examples for ideas.
  • Add a "Chat with us" link on your contact or pricing page so visitors can open the chat from your content.
  • Set office hours and an honest offline message.

For the bigger picture of planning coverage, chatbots and your team's workflow, read our guide on how to add live chat to any website.

Troubleshooting

The chat doesn't appear. Check you're logged out (or that "hide for administrators" is off), clear your caching plugin and any CDN cache, and confirm the page isn't on a "hide on" list. Make sure your domain is allowed in your chat tool's settings.

It appears twice. You've probably installed both a plugin and the embed code. Remove one.

It appears on the wrong pages. Review your plugin's visibility settings, or wrap your child-theme code in a conditional such as is_page().

A security or optimization plugin blocks it. Some plugins delay or combine JavaScript. Exclude the chat script from those optimizations if the widget loads late or not at all.

How to do this in RetroChat

RetroChat has an official WordPress plugin, RetroChat Live Chat, that you can download here. Upload the zip under Plugins → Add New Plugin → Upload Plugin, activate it, then paste your widget key (found under Install in your RetroChat dashboard) into Settings → RetroChat and save. A Test connection button confirms it's linked. Future updates show up in your WordPress dashboard, so you only upload it once.

The plugin lets you hide the chat for logged-in administrators and on chosen pages (by page ID or URL path, with wildcards such as /shop/*), add a "Chat with us" button with the [retrochat_button] shortcode or the RetroChat button block, and optionally identify logged-in WordPress users with identity verification. Prefer code? Paste RetroChat's one-line embed code before </body> using either method above. Either way, the widget only loads on the domains you allow. Learn more on our WordPress page.

Get chat live on your WordPress site today

Pick the plugin method unless you have a reason not to, test in a private window and on your phone, and set your greeting and hours. You can try it on your own site with a free 14-day RetroChat trial, no credit card needed.

Frequently asked questions

Can I add live chat to WordPress without a plugin?

Yes. Paste your chat tool's embed code so it loads before the closing </body> tag, ideally through a child theme's functions.php using the wp_footer hook. Avoid editing the parent theme directly, because a theme update will remove your code.

Where do I paste live chat code in WordPress?

Paste it so it loads in the footer of every page, just before </body>. The easiest places are a header/footer code plugin or your chat tool's own plugin. Developers can use the wp_footer hook in a child theme.

Will a live chat plugin slow down my WordPress site?

A well-built chat plugin adds one small script that loads asynchronously in the footer, so it shouldn't block your page from displaying. Test your key pages with a speed tool before and after installing to be sure.

Does live chat work with WordPress caching plugins?

Usually yes, because the widget loads from the chat provider rather than from your cached page. Clear your cache after installing. If you identify logged-in users, make sure pages for logged-in users aren't cached.