Make WordPress Core

Opened 3 years ago

Closed 10 months ago

#42770 closed defect (bug) (worksforme)

Custom HTML Widgets & Google Tracking

Reported by: MacLeroy Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.1
Component: Widgets Keywords:
Focuses: Cc:


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)

#1 @1naveengiri
3 years ago

I personally think, it is a feature which helps to write correct HTML code there in the widget.

#2 @slushman
3 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!

Last edited 3 years ago by slushman (previous) (diff)

#3 @slushman
3 years ago

  • Keywords reporter-feedback added; close removed
  • Resolution invalid deleted
  • Status changed from closed to reopened
Last edited 3 years ago by slushman (previous) (diff)

#4 @westonruter
3 years ago

@MacLeroy What are the specific validation errors that are blocking you from saving? You can see them by hovering over the error indicators in the editor “gutter” (left margin).

#5 @audrasjb
10 months ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from reopened to closed

Still needs reporter feedback. I'm closing this ticket as worksforme. Feel free to reopen it if you can provide steps to reproduce the issue.

Note: See TracTickets for help on using tickets.