WordPress.org

Make WordPress Core

Opened 5 weeks ago

#44082 new defect (bug)

settings_errors() wraps all notices in p and strong tags

Reported by: johnjamesjacoby Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

I noticed today that settings_errors() wraps every notice in a set of <p> and <strong> tags.

This is undesirable for a few reasons:

  • Notices should be allowed to use their own formatting (they already are everywhere)
  • Many/most core notices that do not use settings_errors() are not strong, or use strong for emphasizing specific parts of a notice

As a result, almost every plugin is forced to reinvent their own approach for putting out admin notices. Core even does this in a bespoke way in almost every other admin page, resulting in a bunch of duplication and fragmentation of approaches.

(A quick grep of .php files in wp-admin with is-dismissible in them shows 75.)


A few ideas:

  • We could use wpautop() to wrap each notice to avoid duplicate <p> tags
  • We could use KSES to only allow certain tags in a notice (not certain this is necessary)
  • We could invent a new function for formatting admin area notices in places other than settings (which most plugins do already, so something they can use is preferable)

I can also imagine this issue being a smaller part of a larger admin_notices initiative, but figured I'd at least document this kvetch.

Change History (0)

Note: See TracTickets for help on using tickets.