最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

wp admin - Custom roles showing HTML entities in title form field

programmeradmin3浏览0评论

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',
    'Resource Manager',
    array(
      '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?

发布评论

评论列表(0)

  1. 暂无评论