[wp-trac] [WordPress Trac] #27446: PHP notice for media attached to no more registered post type

WordPress Trac noreply at wordpress.org
Tue Mar 18 18:47:37 UTC 2014


#27446: PHP notice for media attached to no more registered post type
--------------------------+-----------------------------
 Reporter:  afercia       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 This is a follow-up to #22312.

 as far as I see, #22312 fixed this when users delete a post but I still
 can see PHP notices in one scenario.
 I've just tested on 3.9-beta1-27528 and used this plugin:
 [http://wordpress.org/plugins/animate-slider/ Animate Slider]

 to reproduce:

 1. install the plugin
 2. create a new 'Slider' CPT
 3. insert an image in the body of the post, I mean don't create a real
 slider but just attach an image as you would do in a standard post
 4. save the post
 5. don't delete the post, deactivate the plugin instead and doing so
 you've just unregistered the 'Slider' CPT
 7. go in your media library
 8. next to the image you used in your 'Slider' you will see those PHP
 notices

 I suppose that's because #22312 patch checks for the attachment parent
 post existence and it still does exist but it's no more a registered post
 type so  get_post_type_object() checks that CPT in the global
 $wp_post_types, can't find it and returns null

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27446>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list