Tous les guides de plateforme

Add the selector to a WordPress site

CMSTheme code field, child theme, or header.php

Testé par nous sur un vrai site, dernière vérification 2026-08-04.

Copy the snippet from Settings, then Selector, in your project. Three routes, best first. Stop at the first one that applies to you.

WordPress itself has no built-in field for this. Appearance, then Customize, then Additional CSS takes CSS only, and the block Site Editor cannot add scripts. So it is either a field your theme or page builder already gives you, or code.

Where the snippet goes

Route 1, a code field you already have

Nothing to install if your theme or page builder is one of these. The field is part of what you already paid for.

  • Divi. Sidebar Divi, then Theme Options, then the Integration tab. Switch on Enable header code and paste into the box for code in the <head>.
  • Avada. Sidebar Avada, then Options, then Advanced, then Code Fields. Paste into the field for space before </head>, then Save Changes.
  • Elementor Pro. Sidebar Elementor, then Custom Code, then Add New Custom Code. Set Location to <head>, paste, then Publish and set the condition to your whole site. (Free Elementor does not have this.)
  • Astra Pro. Astra, then Site Builder, add a Custom Layout, choose the Hooks layout, paste into the Code Editor, set the action to wp_head and Display On to Entire Website, then Publish.
  • GeneratePress Premium. Appearance, then Elements, then Add New, choose Hook, paste, set Hook to wp_head and Location to Entire Site, then Publish.
  • Kadence Pro. Appearance, then Kadence, enable Header/Footer Scripts.

Your SEO plugin is not one of these, and this catches people out. Yoast SEO, Rank Math and All in One SEO have no field for adding a script to your head. What they do have are boxes for search-engine verification codes, which look like the right place and are not. Do not paste the snippet there.

If none of the above is you, and the free version of your theme is all you have, use route 2.

Route 2, your child theme's functions.php

Requires a child theme. Back up the file before you change it, or copy its contents somewhere safe, because a mistake here takes the site down until it is undone.

File: wp-content/themes/<your-theme>-child/functions.php

Add this at the very end, and nothing else:

add_action( 'wp_head', 'ultim_translate_head', 1 );
function ultim_translate_head() {
	?>
	<script src="https://translate.ultimsuite.com/ut/v1.js" defer data-ut-tenant="YOUR-PROJECT"></script>
	<?php
}

Replace the whole <script ...></script> line with the snippet from your Selector settings, which already has your project in it.

To get there: Appearance, then Theme File Editor (on a block theme it is under Tools). Set Select theme to edit to the child theme, click Select, choose functions.php, add the code at the bottom, then Update File.

The 1 is the priority and puts the tag near the top of your head. Leave it as it is.

Route 3, header.php

Only if you have no child theme and no code field. A theme update overwrites this file and your snippet disappears with it, silently, so prefer route 1 or 2 if either is open to you.

File: wp-content/themes/<your-theme>/header.php

Add this one line, on its own line, immediately after the <?php wp_head(); ?> line:

<script src="https://translate.ultimsuite.com/ut/v1.js" defer data-ut-tenant="YOUR-PROJECT"></script>

Again, use the snippet from your Selector settings rather than typing this out.

The trap on WordPress

The two boxes above hold two different things and they are not interchangeable.

functions.php is PHP. header.php is mostly HTML with pieces of PHP inside it. Put the wrong one in the wrong file and:

  • A plain <script> tag pasted into functions.php does not error. It quietly prints text before the page starts, and you get "Cannot modify header information" warnings and a site that misbehaves in ways that do not point back to what you did.
  • The PHP block pasted into header.php breaks the file. If it lands in the middle of one of the <?php ... ?> sections that theme files are full of, you get a white screen and a message like Unmatched '}' in wp-content/themes/astra/header.php. This has actually happened to one of our merchants, on Astra, from exactly this.

So: the add_action block goes in functions.php and nowhere else. The single <script> line goes in header.php and nowhere else, on its own line, outside every <?php ... ?> block.

If you do break it, undo the edit and the site comes back. Using the built-in Theme File Editor helps: it checks the file after saving and rolls the change back if the site stops responding. Editing over FTP or in your host's file manager has no such net.

Some hosts and security plugins disable the Theme File Editor entirely, in which case routes 2 and 3 need FTP or your host's file manager, and route 1 is worth a second look.

How to know it worked

Open your site and view the page source, then search for ut/v1.js. One match means the snippet is live.

The check on the Selector settings screen confirms it for you and turns green on its own. Give it a minute after saving.