[wp-trac] [WordPress Trac] #51288: Drop deprecated database column upon upgrade

WordPress Trac noreply at wordpress.org
Thu Sep 10 14:36:54 UTC 2020


#51288: Drop deprecated database column upon upgrade
--------------------------+-----------------------------
 Reporter:  leogermani    |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Database      |    Version:
 Severity:  normal        |   Keywords:  needs-patch
  Focuses:                |
--------------------------+-----------------------------
 I just stumbled upon some issues with (very) old blogs that still have the
 post_category column in the posts table.

 After this column was removed 11 years ago
 (https://core.trac.wordpress.org/ticket/9435#comment:2) we never handled
 their removals on db upgrades.

 This is an issue because we have a magic getter in WP_Post class that will
 fill the non existent post_category property. However, if the column
 exists in the database, the magic getter isn't triggered and we get 0
 every time. So I think we can consider this a bug.

 Link to the magic getter -> https://github.com/WordPress/wordpress-
 develop/blob/master/src/wp-includes/class-wp-post.php#L311

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


More information about the wp-trac mailing list