Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#17784 closed defect (bug) (duplicate)

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

Reported by: lewismcarey's profile 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 12 years ago.

Download all attachments as: .zip

Change History (8)

#1 @lewismcarey
12 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

#2 @ocean90
12 years ago

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

#3 @kawauso
12 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 )

@kawauso
12 years ago

#4 @nacin
12 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.

#5 @nacin
12 years ago

#17215 and even earlier, #12792

#6 @coffee2code
12 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).

#7 @helenyhou
12 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.