Open
Description
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
- Create snippet of type “HTML”
- insert just this:
- save the snippet
- go to the list of snippets
- try to activate the snippet using the UI switch
- should result with exclamation mark and console.log “Could not activate snippet: code did not pass validation.”
- 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/