Opened 7 years ago
Closed 5 years ago
#42770 closed defect (bug) (worksforme)
Custom HTML Widgets & Google Tracking
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.9.1 |
Component: | Widgets | Keywords: | |
Focuses: | Cc: |
Description
Cannot save valid HTML code in the Custom HTML Widget if it contains Google outbound tracking links. It generates the "There are XX errors which must be fixed before you can save."
Change History (5)
#2
@
7 years ago
- Keywords close added
- Resolution set to invalid
- Status changed from new to closed
Hey @MacLeroy, thanks for posting your first ticket!
Are you trying to save a link with an onclick attribute, like this?
<a href="http://www.example.com" onclick="trackOutboundLink('http://www.example.com'); return false;">Check out example.com</a>
The Custom HTML widget sanitizes the submitted HTML by checking against a list of allowed HTML tags and their allowed attributes. By default, the onclick attribute isn't allowed for the A tag, so the code linter is warning you that it found invalid code, like @1naveengiri mentioned above.
However, if you're an admin or have the capability of posting unfiltered HTML, you should be able to save a link like the one above. I was able to save that example link above in a Custom HTML widget.
Are you an admin on this site you're working on?
Do you have any other plugins installed and activated?
Are you using one of default themes?
I'm wondering if something else is conflicting and causing the error you're seeing.
Thanks for contributing to WordPress!
#3
@
7 years ago
- Keywords reporter-feedback added; close removed
- Resolution invalid deleted
- Status changed from closed to reopened
I personally think, it is a feature which helps to write correct HTML code there in the widget.