Skip to content

HTML Snippet doesn’t validate with HTML ‘class’ property #228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lightbulbman opened this issue Mar 6, 2025 · 0 comments
Open
Labels

Comments

@lightbulbman
Copy link
Contributor

Current behavior

User reports:
Hi, I think I found a bug in validator.

HTML snippet with html such as

will not activate from the manage snippets table - toggle switch and shows following error:

{"success":false,"data":{"type":"action_error","message":"Could not activate snippet: code did not pass validation."}}

The snippet can be activated from the edit snippet page but not the manage snippets table

Expected behavior

The snippet should be able to be activated using the toggle in manage snippets table

Steps to reproduce

  1. Create snippet of type “HTML”
  2. insert just this:
  3. save the snippet
  4. go to the list of snippets
  5. try to activate the snippet using the UI switch
  6. should result with exclamation mark and console.log “Could not activate snippet: code did not pass validation.”
  7. Although this code can’t be activated by UI switch in the list, no problems when using [Save changes and activate] button

WordPress version

6.7.2

Code Snippets version

3.6.8

Code Snippets license

Core (free)

Anything else?

Link to original report:

https://wordpress.org/support/topic/snippet-doesnt-validate-with-html-property-class/

lightbulbman added a commit that referenced this issue Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant