How can the unfiltered_html capability be given to non network admins in a multisite install to allow HTML in titles?

In wp-includes/capabilities.php (below) it appears that this capability can not be given to non super_admins.

case 'unfiltered_html':
        // Disallow unfiltered_html for all users, even admins and super admins.
            $caps[] = 'do_not_allow';
        // Fall through if not DISALLOW_UNFILTERED_HTML
    case 'delete_user':
    case 'delete_users':
        // If multisite these caps are allowed only for super admins.
        if ( is_multisite() && !is_super_admin() )
            $caps[] = 'do_not_allow';
            $caps[] = $cap;

Is this possible without removing all html filtering or committing the dirty deed?

Use Case:

Editors and writers are demanding the ability to use <br/> tags in titles to split into 2 or 3 lines when needed.

Current Workaround:

Alternate title metabox that replaces the_title on front end when filled in. (It's confusing the writers)

Easier Solution:

Give them super admin access (publisher will not allow)


Set it up so that your editors and writers use the default title as the first line and add a metabox for a subtitle that will output the other lines as separate lines. This will require a theme adjustment if you want them all included in the h1 header tag. With some adjustments to the admin theme you can get this metabox placed under the title entry field, which should help reduce confusion.

The way WordPress prevents HTML from titles isn't able to be overridden. It's possible only if you hack the core but, even then, it creates a lot of strange problems. Feeds can't handle HTML in titles and the permalinks behave wierdly unless you rewrite the permalink functions. Leaving the default title alone and using custom fields is the way to go.


For me, I would offer a simple marker to indicate a line break (for example, a double colon), then swap them out for actual line breaks when displaying (with the_title filter).

This way, you could also keep it 'context aware', so that line breaks aren't printed in places where they're unsuitable or unsightly (like the admin).

Topped off with a little one-time notice, or helper icon beside the title input, to inform new authors & editors of the feature.

I know this isn't the answer you're looking for, but I hope it might sway you nonetheless ;)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.