Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#27439 closed defect (bug) (fixed)

Warning on WP Media List Table when Custom Post Type No Longer Active

Reported by: wpsmith's profile wpsmith Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.7
Component: Media Keywords: has-patch dev-feedback
Focuses: administration Cc:

Description

Currently, with a custom post type that no longer exists, a Media object that is attached to a post in that custom post type throws a warning.
Screenshot

To Repeat Warning:

  1. Create a custom post type via functions.php or a plugin.
  2. Create a new post
  3. Upload an image to that custom post type as a featured image
  4. Comment custom post type code in functions.php or deactivate plugin.
  5. Go to Media Library (domain.com/wp-admin/upload.php)

You will see the warning in the Uploaded to column.

Attachments (2)

class-wp-media-list-table.php.patch (752 bytes) - added by wpsmith 11 years ago.
First pass
27446-capabilities.png (54.0 KB) - added by afercia 11 years ago.

Download all attachments as: .zip

Change History (9)

#1 @wpsmith
11 years ago

  • Keywords has-patch dev-feedback added

#2 @SergeyBiryukov
11 years ago

  • Component changed from Administration to Media
  • Milestone changed from Awaiting Review to 3.9
  • Version changed from trunk to 3.7

Introduced in [25140]. Previously: #22312.

#3 @SergeyBiryukov
11 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 27560:

Avoid PHP notices in Media Library if an attachment parent post type no longer exists.

props wpsmith.
fixes #27439.

#4 @SergeyBiryukov
11 years ago

#27446 was marked as a duplicate.

#5 follow-up: @afercia
11 years ago

sorry Sergey, maybe I'm in a dumb moment but I still can see those PHP notices.. please check attached screenshot, where you can see I'm testing on trunk 27615.

Just checking capabilities.php on line 1112, seems to me that $post_type at that point is NULL, and that's (and following lines) the reason for the notices.

#6 in reply to: ↑ 5 ; follow-up: @SergeyBiryukov
10 years ago

Replying to afercia:

sorry Sergey, maybe I'm in a dumb moment but I still can see those PHP notices.

You're right, I've reopened #27446 for 4.0. See #16956 for map_meta_cap() fixes in a future release.

#7 in reply to: ↑ 6 @afercia
10 years ago

Replying to SergeyBiryukov:

You're right, I've reopened #27446 for 4.0. See #16956 for map_meta_cap() fixes in a future release.

Yup, I've seen that, thank you very much Sergey.

Note: See TracTickets for help on using tickets.