Skip to main content

How to install AI agent on your WordPress website

Step-by-step instructions on installing Astra's AI Agent on WordPress website.

S
Written by Support Wati
Updated over a month ago

Summary

You can install Astra AI agent on any website created with WordPress in just a few steps by copying a code snippet from your Astra Dashboard and pasting it into your site’s HTML. Once installed, you can choose how Astra appears - either as a chat widget, a spotlight view, or with the optional magic highlighter feature.

Instructions

Follow these steps to install Astra on your website:

Method 1: Using the "Code Snippets" Plugin (recommended)

Step 1: Get your installation code

  • Log in to your Astra Dashboard at https://astra.wati.io.

  • Click Install agent button.

  • Select Copy Code to copy your installation code.

Step 2: Add the code to your website

On your WordPress Admin Portal, use any plugin that allows you to add an HTML Code.

If you don't have it already, you can install the WPCode Plugin.

Once you install the plugin, follow these steps -

  • Click on 'Add Snippet' & then click on 'Add your Custom Code'

  • Choose 'HTML Snippet'

  • Paste the Astra AI agent's widget code and then Activate & Update

Step 3: Verify

  • Refresh your website. You should now see the Astra widget appear.

Method 2: Adding via Child Theme’s functions.php

Step 1: Get your installation code

  • Log in to your Astra Dashboard at https://astra.wati.io.

  • Click Install agent button.

  • Select Copy Code to copy your installation code.

Step 2. Check the child theme

  • In Appearance > Themes, make sure the active theme is a child theme.

  • If you don’t have one, create a child theme first.

Step 3. Edit the functions.php file

  • In Appearance > Theme File Editor (or through FTP/SFTP), open Theme Functions (functions.php).

  • Add the copied Astra AI agent's code at the end.

  • Save the changes.

Step 4. Clear the cache and validate

  • Clear any WP cache, server cache, or CDN cache.

  • Clear the browser cache and reload your site.

  • Confirm the widget appears and works.

Notes

  • Be careful with edits. A syntax error in functions.php can break your site. Always keep a backup. If something goes wrong, disable the snippet or remove the added code.

  • Avoid editing parent theme files directly. Make changes only in the child theme to prevent issues during updates.

Did this answer your question?