WordPress.org

Make WordPress Core

Opened 9 months ago

Closed 9 months ago

#52413 closed defect (bug) (duplicate)

srcset attribute is being removed when using user role editor

Reported by: charles101 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Formatting Keywords:
Focuses: Cc:

Description

Hi Folks

I have an issue with the user role editor. The attribute srcset is being removed magically from the rendering.

Try this out as non admin user:

<img src="feuerwehr-320.jpg" srcset="feuerwehr-640.jpg 2x, feuerwehr-960.jpg 3x, feuerwehr-1280.jpg 4x">

This is the rendered response with the missing srcset attribute.

{
	"id": 181,
	"date": "2021-02-01T10:05:29",
	"date_gmt": "2021-02-01T10:05:29",
	"guid": {
		"rendered": "http://woocommerce.wordpress.test/ch-de/?page_id=181",
		"raw": "http://woocommerce.wordpress.test/ch-de/?page_id=181"
	},
	"modified": "2021-02-01T10:05:29",
	"modified_gmt": "2021-02-01T10:05:29",
	"password": "",
	"slug": "",
	"status": "draft",
	"type": "page",
	"link": "http://woocommerce.wordpress.test/ch-de/?page_id=181",
	"title": { "raw": "test", "rendered": "test" },
	"content": {
		"raw": "<img src=\"feuerwehr-320.jpg\">",
		"rendered": "<p><img src=\"feuerwehr-320.jpg\"></p>\n",
		"protected": false,
		"block_version": 0
	},
	"excerpt": { "raw": "", "rendered": "", "protected": false },
	"author": 2,
	"featured_media": 0,
	"parent": 0,
	"menu_order": 0,
	"comment_status": "closed",
	"ping_status": "closed",
	"template": "",
	"meta": [],
	"permalink_template": "http://woocommerce.wordpress.test/ch-de/%pagename%/",
	"generated_slug": "test",
	"_links": {
		"self": [
			{
				"href": "http://woocommerce.wordpress.test/ch-de/wp-json/wp/v2/pages/181"
			}
		],
		"collection": [
			{ "href": "http://woocommerce.wordpress.test/ch-de/wp-json/wp/v2/pages" }
		],
		"about": [
			{
				"href": "http://woocommerce.wordpress.test/ch-de/wp-json/wp/v2/types/page"
			}
		],
		"author": [
			{
				"embeddable": true,
				"href": "http://woocommerce.wordpress.test/ch-de/wp-json/wp/v2/users/2"
			}
		],
		"replies": [
			{
				"embeddable": true,
				"href": "http://woocommerce.wordpress.test/ch-de/wp-json/wp/v2/comments?post=181"
			}
		],
		"version-history": [
			{
				"count": 19,
				"href": "http://woocommerce.wordpress.test/ch-de/wp-json/wp/v2/pages/181/revisions"
			}
		],
		"predecessor-version": [
			{
				"id": 204,
				"href": "http://woocommerce.wordpress.test/ch-de/wp-json/wp/v2/pages/181/revisions/204"
			}
		],
		"wp:attachment": [
			{
				"href": "http://woocommerce.wordpress.test/ch-de/wp-json/wp/v2/media?parent=181"
			}
		],
		"wp:action-publish": [
			{
				"href": "http://woocommerce.wordpress.test/ch-de/wp-json/wp/v2/pages/181"
			}
		],
		"wp:action-assign-author": [
			{
				"href": "http://woocommerce.wordpress.test/ch-de/wp-json/wp/v2/pages/181"
			}
		],
		"curies": [
			{ "name": "wp", "href": "https://api.w.org/{rel}", "templated": true }
		]
	}
}

As admin this action is working fine, need to be something with the sanitize function.

Change History (2)

#1 @charles101
9 months ago

  • Summary changed from srcset attribute is beeing removed when using user role editor to srcset attribute is being removed when using user role editor

#2 @ocean90
9 months ago

  • Component changed from General to Formatting
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hello @charles101, welcome to WordPress Trac!

Thanks for the ticket. We're already tracking this issue in #29807. Going to close this as a duplicate.

Note: See TracTickets for help on using tickets.