Lightweight JS Snippet

Changelog

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 to manage_options power 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 use esc_textarea() for the snippet field.
  • Add the missing License, License URI and Text Domain headers, fix the text-domain mismatches, and add an explicit version to wp_enqueue_script().
  • Bumped minimum PHP to 7.4. Tested up to WordPress 6.9.

1.2

  • Bugfix when escaping script.

1.1

  • Code editor added.
  • Support for multiple ids.
  • Securing plugin.

1.0

  • Initial release.

Plugin Website
Visit website

Version:
1.4.1
Last Updated
May 4, 2026
Requires
WordPress 5.0
Tested Up To
WordPress 6.9.4
Requires PHP
7.4

Share Post

Join our newsletter.

Get insights into what’s happening at ChangelogWP right in your inbox. We don’t believe in spam.