In WordPress you add the widget once for the whole site: with the WPCode plugin or in a child theme with wp_enqueue_script(). Mark images through the alt text in the media library or the image block.
A file name with --ai does not work, because WordPress collapses double hyphens on upload. For shops there is a separate WooCommerce guide.
Add the script tag
<script src="https://www.ai-label.app/widget.js" defer></script>
The script tag belongs once in the head of every page, not in single posts. The simplest way is the WPCode plugin: “Code Snippets” menu, header field (“Scripts in Header”), save. With your own theme, load the script in a child theme with the defer strategy:
add_action( 'wp_enqueue_scripts', function () {
wp_enqueue_script( 'ai-label', 'https://www.ai-label.app/widget.js', array(), null, array( 'strategy' => 'defer' ) );
} );
A script tag in a Custom HTML block only works on that one page. Only roles with the unfiltered_html capability may save it, which means administrators and editors on a single site and only super admins on a network.
Mark images
Which images need a label is your decision, for example with the labelling check. The widget only labels marked images, in three ways that can be combined:
- Attribute on the image:
data-ai-label="generated"for images created entirely with AI,data-ai-label="modified"for photos edited with AI. - File name with a marker before the extension:
vase--ai.jpgorvase--ai-mod.jpg. - Alt text ending in “(AI-generated)” or “(AI-modified)”.
In WordPress, mark images through the alt text. You find it in an image's details in the media library and in the image block settings in the block editor. Featured images take their alt text from the media library.
The file name does not work. On upload, sanitize_file_name() collapses several hyphens into one. vase--ai.jpg becomes vase-ai.jpg, and the marker is gone. The data-ai-label attribute is only worth it in theme templates.
Pitfalls
- Alt text in older posts: the image block stores the alt text in the post when you insert it. A later change in the media library does not reach existing image blocks. Add the suffix there one by one.
- Delayed JavaScript: optimisation plugins sometimes hold scripts back until the visitor scrolls or taps, for example “Delay JavaScript execution” in WP Rocket. Then the label is missing at first view. Add
widget.jsto the exclusion list (“Excluded JavaScript Files”). - Page cache: after adding the script, clear the cache of your caching plugin and, if you use one, your CDN.
- Theme update: changes made directly in the parent theme are lost with the next update; in a child theme they stay.
Limits of the widget
- The widget only reaches
<img>elements on pages with the script. Background images from the stylesheet and images under 48 pixels (adjustable withdata-min) stay unlabelled. - Newsletters and RSS feeds show your images without the script, so without the label.
- It cannot reach emails such as order confirmations. For images outside your website, create a copy with the label burned in using Label an AI image.
- Privacy: when the script loads from ai-label.app, our host sees the IP address, as with any request. The script sets no cookies. Mention it in your privacy policy.
Native app
A dedicated WordPress app is planned. There is no date yet.
Get notified when the WordPress app launches
We will email you once when the app launches.
Frequently asked questions
Can I paste the script tag into a post?
Then it only works on that page, and only roles with unfiltered_html may save it. For the whole site, use WPCode or a child theme.
Why does an older post have no label?
The image block stored the alt text when it was inserted, and a later change in the media library does not reach it. Add the suffix in the block.
Sources
Para. refers to the paragraph number in the European Commission's guidelines on Article 50, C(2026) 5054.
- WPCode in the WordPress plugin directoryWordPress.org · Platform · 8 Oct 2026
- WordPress Developer Resources: wp_enqueue_script()WordPress.org · Platform · 11 Oct 2026
- WordPress Theme Handbook: child themesWordPress.org · Platform · 26 Jan 2024
- WordPress documentation: Media Library screenWordPress.org · Platform · 6 Jun 2024
- WordPress source code: sanitize_file_name() (version 7.1.3)WordPress · Platform · 11 Oct 2026
- WordPress documentation: Roles and capabilitiesWordPress.org · Platform · 2 Sept 2026
- WP Rocket: Delay JavaScript executionWP Media · Platform · 11 Mar 2026
- Code of Practice on Transparency of AI-Generated Content (final version)Europäische Kommission · Code of practice · 10 Jun 2026
- Regulation (EU) 2024/1689 (AI Act)EUR-Lex · Law · 12 Jul 2024


