WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#35897 closed defect (bug) (invalid)

wp_strip_all_tags the titles in Recent Posts widget

Reported by: alexvorn2 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4.2
Component: Widgets Keywords:
Focuses: ui, template Cc:
PR Number:

Description

In the Recent Posts the titles are not stripped by tags, so when adding a <br> tag in the post title, it adds a new line.

http://alexvorn.com/wp-content/uploads/2016/02/br-tags-bug-in-recent-posts-widget.png

to fix this we just use this function https://codex.wordpress.org/Function_Reference/wp_strip_all_tags .

Change History (3)

#1 @dd32
4 years ago

What about if you've added a <strong> tag to a phrase you want to add emphasis to? Should we strip that too?

We allow trusted users with the unfiltered_html capability to post HTML in titles, and I'm not sure why we should apply a more strict sanitization to the Recent Posts widget vs the article titles.

What's your use-case for stripping HTML from the widget vs articles?

#2 @alexvorn2
4 years ago

<strong> tag should removed too, we need to make the every item in the list to have the same style.
In the post, the title will not be affected.

My case is that I use <br> tags to make the title look the way I want, divided by new lines, but I don't like how it works in the list widget so the temporary fix for this is using a custom Recent Posts widget.

A lot of other widgets I use - replace the standard widgets, so I want to see if my idea/concept is introduced as a fix, if not - then If someone will ask me why I use custom made widgets I will point to this ticked that no everything works as I think should work.

#3 @dd32
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

I'm going to mark this as invalid; for the fact that it's by design.

I don't think we should change that design, but theme authors and individual sites are welcome to extend those widgets to customise them as they see for for their site.

Note: See TracTickets for help on using tickets.