# Add Ishara to WordPress

Add the feedback widget to a WordPress site with the free WPCode plugin, or with two hooks in your theme’s functions.php.

- Where it goes: Code Snippets → Header & Footer → Footer (the WPCode plugin)
- Plan: Self-hosted WordPress: none, the plugin is free. WordPress.com: a paid plan (Personal or higher), because free sites can’t install plugins.
- Allowed domains: your own domain, plus your-site.wordpress.com (WordPress.com, until you connect your own domain)
- Time: about 3 minutes

## Steps

1. In Ishara, open **Sites → your site → Install** and copy the line under **Add the line to your site**. Your site’s key is already in it:

```html
<script src="https://useishara.com/w.js" data-site="pk_…" defer></script>
```

2. In WordPress, go to **Plugins → Add New**, then install and activate the free **WPCode – Insert Headers and Footers + Custom Code Snippets** plugin.
3. Go to **Code Snippets → Header & Footer**.
4. Paste the line into the **Footer** box and click **Save Changes**. WPCode prints it exactly as you pasted it, at the end of every page.
5. If you use a caching plugin or your host caches pages, clear the cache.
6. Open your site. Back on the **Install** page, **Check it’s live** turns into **The widget is live** as soon as the widget loads. Then open the **Reviewer link** from the same page: only people who open it see **Leave a note**.

## Without a plugin: functions.php

If you’d rather keep it in code, add this to your theme’s (or child theme’s) `functions.php`, or to a small must-use plugin. It loads the script on every page, deferred, near the end of the body. WordPress can’t add a `data-site` attribute through `wp_script_add_data()`, so the `script_loader_tag` filter adds it.

```
function ishara_widget() {
  wp_enqueue_script( 'ishara-widget', 'https://useishara.com/w.js', array(), null, array( 'strategy' => 'defer', 'in_footer' => true ) );
}
add_action( 'wp_enqueue_scripts', 'ishara_widget' );

function ishara_widget_key( $tag, $handle ) {
  return 'ishara-widget' === $handle ? str_replace( ' src=', ' data-site="pk_…" src=', $tag ) : $tag;
}
add_filter( 'script_loader_tag', 'ishara_widget_key', 10, 2 );
```

## Good to know

- Performance plugins that combine or delay JavaScript (WP Rocket, Jetpack Boost and others) can change the tag. If the widget doesn’t appear, exclude `w.js` from their optimisations.
- The steps are the same for block themes and classic themes.
- On WordPress.com, the same WPCode plugin and the same **Code Snippets → Header & Footer** screen apply once the site is on a paid plan.

Checked against the official docs on 2026-11-12: [WPCode: global header and footer](https://wpcode.com/docs/using-the-global-header-footer-settings/), [WPCode on WordPress.org](https://wordpress.org/plugins/insert-headers-and-footers/), [wp_enqueue_script](https://developer.wordpress.org/reference/functions/wp_enqueue_script/), [script_loader_tag](https://developer.wordpress.org/reference/hooks/script_loader_tag/), [WordPress.com: adding code to headers](https://wordpress.com/support/adding-code-to-headers/), [WordPress.com: plugins](https://wordpress.com/support/plugins/).
