Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#4077 closed defect (bug) (fixed)

Need ability to add namespace to admin screens HTML header

Reported by: jhodgdon Owned by: rob1n
Milestone: 2.2 Priority: normal
Severity: minor Version: 2.1.2
Component: Administration Keywords: has-patch 2nd-opinion
Focuses: Cc:


A certain Google Maps API requires that an additional xmlns attributed be added to the HTML header tag so that Internet Explorer will render it correctly (sigh). While the Theme has control over HTML headers for external viewing, wp-admin/admin-header.php has control over HTML headers for the admin screens, and there is no namespace hook. (The API is being used in both admin and external screens.)

So, I would like to request a hook be added. Patch coming shortly.

I have tested that no behavior changes in 2.1.2 and [5176] when my hook is added, and that my plugin can use the hook to add a namespace. I also verified it was a new hook name.

Attachments (2)

admin-header-php2.diff (875 bytes) - added by jhodgdon 9 years ago.
Patch to add namespace hook to admin header
admin-header-php2.2.diff (880 bytes) - added by jhodgdon 9 years ago.
New version with better name for action (admin_html_ns - I liked that option)

Download all attachments as: .zip

Change History (12)

@jhodgdon9 years ago

Patch to add namespace hook to admin header

comment:1 @rob1n9 years ago

  • Owner changed from anonymous to rob1n

Maybe a more descriptive filter name? Such as admin_header_ns or admin_html_ns?

Just wondering, seeing as admin_ns isn't very descriptive. Maybe even do "namespace" instead of abbreviating it to "ns."

comment:2 @rob1n9 years ago

  • Cc rob1n added

comment:3 @jhodgdon9 years ago

I was following the convention of the other namespace actions, such as atom_ns, rdf_ns, etc.

comment:4 @jhodgdon9 years ago

That said, I would be happy to have the name be something else... the existing convention is not great.

There are unfortunately precidents for both inconsistencies and cryptic names... at least I have the ones in 2.1.2 now documented at http://codex.wordpress.org/Plugin_API/Action_Reference and http://codex.wordpress.org/Plugin_API/Filter_Reference -- many opportunities to make things more consistent, except for the fact that plugins are probably already using the inconsistent names.

@jhodgdon9 years ago

New version with better name for action (admin_html_ns - I liked that option)

comment:5 @rob1n9 years ago

  • Keywords 2nd-opinion added

I do too, but I want to get Ryan's input on this. I'm +1.

comment:6 @rob1n9 years ago

  • Keywords action IE admin header removed

comment:7 @rob1n9 years ago

I thought about this a bit more, and now I'm going for a new filter name: admin_xml_ns. *Technically* it's XML's namespace, not HTML's. And the NS could specify something that isn't HTML.

comment:8 @rob1n9 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [5181]) Add admin_xml_ns action to <html> in the admin header. Props jhodgdon. fixes #4077

comment:9 @JeremyVisser9 years ago

If it's XML's namespace, then adding "xml" to the namespace name is a bit redundant, eh?

comment:10 @JeremyVisser9 years ago

Oh hang on, sorry. I didn't look at the code. admin_xml_ns is the hook name.

Note: See TracTickets for help on using tickets.