I've created a few custom roles. I'm noticing that when editing a post in the Admin Area, any characters with HTML entities in the title form field are showing the HTML entity code, but only for users assigned the custom roles. Users with default WordPress roles aren't having this issue.

This is one of the roles I've created:

  $resource_manager_role = add_role(
    'Resource Manager',
      'read' => true,
      'edit_posts' => true,
      'edit_others_posts' => true,
      'edit_published_posts' => false,
      'delete_posts' => true,
      'delete_others_posts' => true,
      'delete_published_posts' => true,
      'publish_posts' => false,
      'upload_files' => true
add_action( 'after_setup_theme', 'add_resource_manager_role' );

If a user with this Resource Manager role creates or edits a post and puts an & (for example) in the title field, upon saving or publishing the post, it gets converted to & in the title field.

I've tried testing this on a fresh install of WordPress with no plugins or themes. I've also tried creating the roles with a plugin instead of with my own code.

Lastly, it doesn't seem to matter if I'm using the block editor or classic editor. I get the same result editing a regular post or custom post type.

Any ideas what's going on here?

Your Answer

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

Browse other questions tagged or ask your own question.