WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 2 years ago

#17784 closed defect (bug) (duplicate)

media items uploaded through post-thumbnails require the post to have editor support

Reported by: lewismcarey Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1.3
Component: Media Keywords:
Focuses: Cc:

Description

When uploading a media item via add featured image (post-thumbnails) on a custom post type that does not support an editor prevents that media item from being inserted into other posts (as the insert into post button is not present) on other post types that do support and editor.
The issue is with media.php line 1289 if ($send)
$send is set to false on these media items.
Media items uploaded to the media library should not be associated with a post-type if they are also going to be available elsewhere or the default $args for send should not be checking for editor support media.php line 1187 (function get_media_item)

Attachments (1)

17784.diff (1.8 KB) - added by kawauso 3 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 lewismcarey3 years ago

add_theme_support('post-thumbnails');
register_post_type('FOO','supports' => array('title'))
register_post_type('BAR','supports' => array('title', 'editor'))

1.add a featured image to FOO (upload a new image)

2.add New BAR

  1. try to insert the image into post in BAR and 'insert into post' button N/A

comment:2 ocean903 years ago

Without testing it, why not adding thumbnail to the supports array too?

comment:3 kawauso3 years ago

  • Keywords has-patch added

More usable test code:

add_action( 'init', 'foo_bar' );

function foo_bar() {
	register_post_type('FOO',array('public' => true, 'supports' => array('title', 'thumbnail')));
	register_post_type('BAR',array('public' => true, 'supports' => array('title', 'editor')));
}

Following patch moves some existing code for the post thumbnail support check further up and uses the calling post's ID where possible, rather than the post parent.

Also changes isset( $_POST ) && count( $_POST ) to !empty( $_POST )

kawauso3 years ago

comment:4 nacin3 years ago

Can even just be if ( $_POST ).

I'm positive there's a duplicate ticket of this somewhere. No doubt seen this reported before.

comment:5 nacin3 years ago

#17215 and even earlier, #12792

comment:6 coffee2code2 years ago

  • Component changed from General to Media
  • Keywords needs-refresh added; has-patch removed
  • Milestone changed from Awaiting Review to Future Release
  • Version set to 3.1.3

Patch no longer applies cleanly (currently r20610).

comment:7 helenyhou2 years ago

  • Keywords needs-refresh removed
  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate: #18912 (fixed in 3.3)

Note: See TracTickets for help on using tickets.