Until now, putting the LayBuild chat widget on a WordPress site meant pasting a PHP snippet into your theme's functions.php. That works, but a theme update can wipe it, and most site owners would rather not open a PHP file at all. We wrote a plugin so the widget is a setting you save. This post covers what the plugin does, how to set it up, and what it adds to your pages.

The plugin is version 1.0.0 and is not in the WordPress.org directory yet. We are preparing that listing. For now we send the zip on request through the contact page, and you upload it by hand.

What the plugin does and does not do

The plugin puts the LayBuild AI chat widget on your site and gives you a settings screen for it. The assistant itself runs on LayBuild AI, a hosted service, so the plugin is useless without a LayBuild AI account and an active plan. If you want a chatbot that lives entirely inside WordPress with no outside service, this is the wrong plugin.

The assistant answers from content you add in LayBuild AI: uploaded documents, pages of your website and saved question-and-answer pairs. When a visitor needs a person, the chat is handed to your team and they reply in the same window. Nothing about your posts or pages is read by the plugin. You choose what the assistant knows by adding it in LayBuild AI.

What you need

  • WordPress 6.0 or newer and PHP 7.4 or newer. Version 1.0.0 is tested up to WordPress 7.1.
  • A LayBuild AI account with an active plan. Plans start at ₹1,499$19 a month and there is no free plan.
  • Your widget key, from Admin → Widget in LayBuild AI. It starts with wkey_.

Setting it up

Upload the zip under Plugins → Add New → Upload Plugin and activate it. At this point nothing has changed on your site, because the plugin loads no script until a widget key is saved.

In LayBuild AI, open Admin → Widget. Add your site's domain to the allowed domains, then copy the widget key. The allowed-domains step is the one people skip, and a widget that refuses to load on the live site is almost always this.

Back in WordPress, go to Settings → LayBuild AI Chatbot, paste the key and save. If the key does not start with wkey_, the plugin rejects it and keeps the key you had before. Open your site and the chat launcher is in the corner. If you run a page cache, clear it first.

What you can change from WordPress

Everything below is on the same settings screen. Leave an appearance field empty and the widget uses whatever you saved in Widget Studio in LayBuild AI, so you only fill in the fields you want to override for this site.

SettingWhat it does
Colour, position, title, greeting, launcher label, avatarChanges how the widget looks on this site
ThemeLight, dark or automatic
Show the chat widgetUnticking it removes the script from your pages
Hide the chat from logged-in usersUseful on membership sites where staff are always logged in
Hide on these pagesKeeps the chat off the posts and pages you list, such as checkout
AgentSends chats to one agent when your workspace has several
Recognise logged-in usersTells your agents who they are talking to. Off by default

To put the chat inside a page instead of floating in the corner, use the shortcode:

[laybuild_chat height="650"]

Recognising logged-in users

This one needs a little explanation, because it is the only setting that involves a secret. With it on, the plugin passes the logged-in user's email address to the widget along with a signature: an HMAC-SHA256 hash of the lowercase email, made with your identity secret. LayBuild AI checks the signature, so a visitor cannot claim to be someone else by editing the page.

The identity secret comes from the same Widget page as the key. If you would rather keep it out of the WordPress database, define it in wp-config.php instead:

php
define( 'LAYBUILD_AI_CHATBOT_SECRET', 'your-identity-secret' );

What it adds to your pages

We were careful here, because a chat plugin that slows a site down is a bad trade. The plugin enqueues one script, widget.js, in the footer with the async attribute, so it does not block the page from rendering. It adds no stylesheet to the page head. It does not load on AMP pages, in feeds or in the WordPress admin.

Options are passed to the widget through a small inline config object printed just before the script. We chose that over data- attributes on the script tag because cache plugins that combine or defer scripts tend to strip those attributes, and the config object survives them.

On the database side, the plugin creates no tables. It stores one row in wp_options, and deleting the plugin removes that row on every site of a multisite network.

For developers

Three filters let you change behaviour without forking the plugin.

HookUse
laybuild_ai_chatbot_should_loadReturn false to hide the widget under your own rules
laybuild_ai_chatbot_configChange the options passed to the widget
laybuild_ai_chatbot_originPoint the plugin at another LayBuild AI address, such as staging

The code follows the WordPress Coding Standards, since that is what the Plugin Check tool and the WordPress.org review test against.

What is still missing

There is no WordPress.org listing yet, so there are no one-click installs or automatic updates. When we ship a new version you will need to upload the new zip. Interface strings are translatable, but we have not published language packs. And the limits of LayBuild AI apply here as everywhere: search over your content is English-first, so answers are most reliable when your documents and the visitor's question are in English.

If you already use the functions.php snippet from the Widget page, it keeps working. Remove it when you switch to the plugin, or the widget script will be added twice.

Frequently asked questions

Do I need a LayBuild AI account to use the plugin?

Yes. The plugin shows the chat widget, and LayBuild AI runs the assistant behind it. You need an account and an active plan for the assistant to reply.

Is the plugin on WordPress.org?

Not yet. We are preparing the listing. Until it is live, ask us for the zip through the contact page and upload it under Plugins → Add New → Upload Plugin.

The chat does not appear on my site. What should I check?

Check that the widget key is saved and "Show the chat widget" is ticked, that your domain is in the allowed domains on the Widget page in LayBuild AI, and that you are not on a page listed under "Hide on these pages". Then clear your page cache.

Will the chatbot slow down my WordPress site?

The widget script loads asynchronously in the footer, after your page content, so it does not block rendering. The plugin adds no stylesheet to the page head.

What happens to my data when I delete the plugin?

The plugin's one settings row is removed from wp_options. Your conversations and knowledge base stay in your LayBuild AI workspace.