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. If you maintain 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 such scripts: administrators and editors on a single site, only super admins on a network. It is the wrong place for a site-wide script.
Mark images
The widget only labels images you have marked. Whether an image needs a label is your call, for example with the labelling check. Three ways, which can be combined:
- Attribute on the image:
data-ai-label="generated"for images created entirely with AI,data-ai-label="modified"for photos changed 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)”. The addition also helps screen readers.
The simplest way in WordPress is alt text. In the media library, open an image's details and add “(AI-generated)” or “(AI-modified)” to the alternative text. In the block editor, the same field is in the image block settings. 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. If you change it later in the media library, existing image blocks keep the old text. 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. That is what the child theme is for.
Limits of the widget
- The widget only reaches images as
<img>on pages where the script runs. Background images from the stylesheet and images under 48 pixels (adjustable withdata-min) get no label. - Newsletters and RSS feeds show your images without the script. No label appears there.
- It cannot reach order confirmation emails. Where you show an image outside your website, use a copy with the label burned in from Label an AI image.
- Privacy: the script loads from ai-label.app, so our host sees the IP address as with any request. It sets no cookies. Mention it in your privacy policy.
Native app
A dedicated WordPress app is planned. There is no date yet. Until then, the widget works without installing anything in the system. If you like, we will write to you once at launch.
Get notified when the WordPress app launches
A short email is enough. We will write once at launch, nothing else.
Frequently asked questions
Can I paste the script tag into a post?
It then only works on that page, and only roles with unfiltered_html may save it. Add it site-wide with WPCode or in a child theme.
Why does an older post have no label?
The image block stored the alt text when it was inserted. A later change in the media library does not reach it. Add the suffix in the block.
Why does the widget not recognise my file name?
On upload, WordPress turns --ai into -ai. Use the alt text.
Is there a WordPress plugin?
A WordPress app is planned. Use the button on this page to be notified once at launch.
Sources
All sources read in full. Paragraph numbers (para.) refer to 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
Not legal advice. This content explains the law based on primary sources; it does not replace an assessment of your individual case.

