Lightweight JS Snippet
A minimal way to inject a single inline JavaScript snippet into the of one or more specific posts, pages or products. You give it a comma-separated list of post IDs and the JS body — that is the entire surface area.
Escolha sólida
Lightweight JS Snippet is a solid plugin choice in 2026, with a few things worth checking first. Was last updated 1 week ago, and scores 64/100 on our health check.
- Desenvolvido ativamente — última atualização 1 semana atrás
- Testado com as últimas WordPress (7.1)
- Base de usuários pequenas (<10 instalações ativas)
- Muito poucos comentários até agora
Como ele se acumula?
Lado a lado em instalações, atualizações, avaliações e suporteDownloads diários
Os picos de download geralmente seguem uma nova versão — cada site que atualiza automaticamente é um download.
Rankings
Where Lightweight JS Snippet stands todayWordPress.org Classificações de pesquisa
Posição ao vivo na pesquisa de plugins, top 100| Palavra chave | Posição |
|---|---|
| head | >100 |
| inline | >100 |
| javascript | >100 |
| post | >100 |
| snippet | >100 |
About Lightweight JS Snippet
From the official readme · v1.4.3Descrição
A minimal way to inject a single inline JavaScript snippet into the <head> of one or more specific posts, pages or products. You give it a comma-separated list of post IDs and the JS body — that is the entire surface area.
The point is the absence of features. There is no per-post UI, no script library, no CDN selector, no “fire on event” toggle. If all you need is to drop a tracking pixel or a tiny script on three specific pages, you do not want a 2 MB plugin that wants to manage your whole site.
Set it up under Settings → Lightweight JS snippet. The page provides a textarea for the JS (no <script> tags — those are added for you) and a comma-separated list of post IDs to load it on.
Instalação
- Upload
/lightweight-js-snippet/to the/wp-content/plugins/directory. - Ative o plugin através do menu Plugins em WordPress.
- Go to Settings → Lightweight JS snippet and paste in your JS plus the post IDs.
Log de Changes
Fixes `
1.4.3
- Fixed: for users without the unfiltered_html capability (multisite),
<in the JavaScript was saved as<and broke comparisons and loops. Text that looks like an HTML tag (e.g.a<b&&c>d) is still removed for those users.
1.4.2
- Fixed:
>and&in the JavaScript were saved as>and&, which broke arrow functions and comparisons. Code saved earlier is repaired automatically. - Fixed: title search and lookup on the settings page failed on sites with plain permalinks.
- Fixed: a
</scriptinside the code can no longer end the script tag early. - The plugin’s settings are removed when it is deleted.
1.4.1
- Fix empty
<script id="jhljs-script">tag rendered on every page when no snippet was configured. Logic error (||where&&was meant) plus no early-return on empty options. - Fix Settings link on the Plugins screen — previous filter targeted the wrong plugin basename, and the URL pointed at a non-existent menu slug. Both corrected.
1.4
- Settings page now lets you pick target posts/pages by typing their title — the “comma-separated post IDs” textbox is replaced with a chip-style picker. Two small REST endpoints (
jhljs/v1/posts,jhljs/v1/search) gated tomanage_optionspower the lookup and search.
1.3
- Sanitize the post-id list and the JS snippet on save via
register_setting()callbacks (digits/commas/whitespace for the IDs,wp_kses'data'for the script — same filter that was already applied on output). - Escape every translated string in the settings UI (
_e()/__()→esc_html_e()/esc_html__()) and useesc_textarea()for the snippet field. - Add the missing
License,License URIandText Domainheaders, fix the text-domain mismatches, and add an explicit version towp_enqueue_script(). - Bumped minimum PHP to 7.4. Tested up to WordPress 6.9.
1.2
- Bugfix when escaping script.
Para desenvolvedores
Este é o seu plugin? Mostre os números.
Adicione um crachá ao vivo ao seu site, Documentos ou Readme do GitHub. Ele é atualizado por conta própria - nenhuma conta necessária.
Best Lightweight JS Snippet alternatives
All head plugins →FAQ
Lightweight JS Snippet: quick answers
Respostas diretas, extraídas de dados ao vivo WordPress.org.
Fonte: WordPress.org
Is Lightweight JS Snippet free?
Yes. Lightweight JS Snippet is free to download and use from the official WordPress.org plugin directory.
Is Lightweight JS Snippet safe to use in 2026?
Lightweight JS Snippet is a solid plugin choice in 2026, with a few things worth checking first. Was last updated 1 week ago, and scores 64/100 on our health check.
How many websites use Lightweight JS Snippet?
Lightweight JS Snippet is active on <10 WordPress websites and has been downloaded 1,493 times since it launched in September 2022. It was downloaded 133 times in the last 30 days.
Does Lightweight JS Snippet work with WordPress 7.1?
Yes. The developer has tested Lightweight JS Snippet up to WordPress 7.1.5, the latest release. It requires WordPress 5.0 or newer.
What PHP version does Lightweight JS Snippet need?
Lightweight JS Snippet requires PHP 7.4 or higher. Most hosts run PHP 8.x today, so it works on any modern WordPress hosting.
When was Lightweight JS Snippet last updated?
The latest version, 1.4.3, was released on November 25, 2026 (1 week ago).
Who makes Lightweight JS Snippet?
Lightweight JS Snippet is developed and maintained by Jonas Hjalmarsson.
What are the best alternatives to Lightweight JS Snippet?
The most popular alternatives to Lightweight JS Snippet are Header and Footer Scripts (200K+ installs), Head & Footer Code (100K+ installs) and Scripts To Footer (7K+ installs).
Alimentado por PageForge
Um modelo e uma planilha. Uma página real para cada pesquisa.
PageForge Transforma cada linha de um CSV em uma página WordPress com seu próprio título, URL, SEO campos e esquema, construído no layout que você já desenhou. Gratuito em WordPress.org.
- CSV e XLSX, mais Google Sheets em Profissional e Empresarial
- Seu próprio título, URL, SEO campos e esquema para cada página
- Funciona com o editor de blocos, Elementor, Divi e Avada
- Gratuito em WordPress.org, sem cartão de crédito

