WordPress 2.3 Database Schema Changes

WordPress 2.3 changes the database schema in three places. The biggest change is the taxonomy related changes I discussed earlier. Since taxonomy was going to cause backward compatibility breaks in the schema, we decided we might as well break it thoroughly and create something we liked. Thus the categories, post2cat, and link2cat tables were dropped and replaced by three new tables. Plugins that reference the old tables will break. They will need to be updated to either use API, preferably, or use SQL that references the new tables instead of the old ones.

The other two changes are small and low-impact. A new status of ‘pending’ was added to the post_status field of the posts table. This won’t affect most plugins. Plugins that check post status might be affected. Those plugins can do some defensive programming to insulate themselves against new status additions.

Finally, several unused fields were dropped from the options table. option_can_override, option_type, option_width, option_height, option_description, and option_admin_level are now gone. These fields have been unused for years. The time had come to finally drop them and clean up the options table.

51 comments to WordPress 2.3 Database Schema Changes

  1. Selcuk E says:

    Thanks for this useful information. I’ll translate the important parts into Turkish and publish in my site for Turkish users. It seems that we will have to fix all the compatibility problems with the former releases of the plugins that we are using.

  2. GaMerZ says:

    in the beta script link2cat, post2cat, categories are not dropped when running upgrade.php. Will it be dropped when it goes gold?

  3. Ryan says:

    GaMerZ, yes, we’ll probably add the drop right before RC1.

  4. btard says:

    Might as well smash it up and clean that crap up. Still on for the 24th for the new version with the dropped tables?

  5. David says:

    There is a reason why many bloggers aren’t even on 2.2 yet. It’s this we’ll change the tables and the plugins will break.

    How can we reduce the plugin is not compatible cycle?

  6. Henry says:

    The big question is….Will WordPress 2.3 be more secured? and about the javascript — it is very slow still – many browsers are having problem with it.

  7. Alex Rabe says:

    Ryan, I assume that also the upgrade-functions.php in http://codex.wordpress.org/Creating_Tables_with_Plugins is permanent moved to the includes folder. Maybe it’s good to inform then the plugin authors for this change, cause this codex page is often used as template.

  8. [...] Príchod novej verzie WordPress 2.3 je na spadnutie a zmeny, ktoré s ním prídu, sa budú týkať aj databázy. [...]

  9. danny says:

    Thanks for the great info.

  10. valent says:

    Thank for your post, I will update, if necessary, my plugin.

  11. [...] Boren beschreibt einige elementare Änderungen der Tabellen, welche mit WordPress 2.3 am 24. September livegehen. Die beiden Tabellen der Kategorien post2cat [...]

  12. [...] The tables used to manage the categories are now replaced by new tables to manage the tags i.e. wp_categories, wp_post2cat and wp_link2cat are replaced by the tables wp_terms, wp_term_taxonomy, wp_term_relationships. Lot of information on tag support is available on the Internet(especially email archives), so treat Google as your friend. More on database schema changes [...]

  13. sekundek says:

    I think WP need to stick with one javascript framework. I see many of it right now in the sources.

  14. Chad says:

    Thanks for the info … Looks like an upgrade will require a lot of QA time.

  15. Mark Penix says:

    Is the pending status change to post in the future instead of just post dating a post? Or is it more for Multiple user based WPblogs for editors/admin to flag as “approved”?

  16. technabob says:

    Does anyone know if there will be a migration path from Ultimate Tag Warrior tags (and permalinks) to WordPress 2.3 tags? If not, I’ll be stuck on my current version forever. I’m way too dependent on those tags and the URLs are all in the search engines now.

  17. DD32 says:

    @technabob:
    Yes, WP has a converter for UTW tags(as well as a Simple Tagging Importer, not sure about others).

    WP also has a Category -> Tag converter(All or a select few if you want).

  18. [...] latest beta and report any bugs or problems you may find. For developers, note that there are some database changes for this version, and plugin compatibility should be checked. Here are more notes on WordPress [...]

  19. [...] There have been some database changes in the next major release of WordPress, v2.3. The changes are going to affect a lot of plugins as outlined in this article from Ryan, WordPress 2.3 Database Schema Changes. [...]

  20. [...] WordPress DE auch gleich hinterher – WordPress 2.3 verbannt Technorati? – VIEL WICHTIGER, sind die Datenbankänderungen in WordPress [...]

  21. purelife says:

    oh dear lord i’ve had enough of this. time to move away from wordpress and to textpattern for me.

  22. [...] appears that the upcoming WordPress 2.3 will contain some database schema changes which I am afraid will break some of the wordpress [...]

  23. [...] holes are found? 2.1 didn’t, if you’ll remember from the 2.2 release notes, but the jump from 2.2 to 2.3 is going to cause some breakage, I think, and that always slows adoption. I’d hope that a reasonable amount of security [...]

  24. [...] UTW call to display tags and tag clouds. Rich Gilchrest provides the details (via Matt). Also, the database design changes in 2.3 might break the plugins which make calls directly to the database. Ryan points to the 2.3 [...]

  25. [...] qui, anche perché ora si parte con la ricerca dei bug e la verifica della compatibilità con la nuova versione di WordPress. 17 Settembre 2007 • tags: WordPress, [...]

  26. [...] the version 2.3, it will make some changes in the database schema in three places. For this, it will cause some plugin compatibility problems. Particularly affected [...]

  27. [...] If you aren’t aware of it yet, this version has some plugin compatibility issues due to some schema changes that can result in breaking the plugins that you’re currently [...]

  28. tricky says:

    I was reading about this, and i’m not PHP/MySQL skilled, but since i work with css/xhtml i tend to understand some code. MySQL syntax is very understable.

    So, if i have a plugin that relays on the old categories tables,


    $wpdb->get_results("SELECT cat_ID as id, cat_name as name FROM $wpdb->categories WHERE category_parent = '$parent_id'");

    shoulde i make the select “id as id” “slug as name” FROM $wpdb->taxonomy WHERE (get only items with taxonomy categoy) ?

  29. [...] 数据库变更 (Database changes) [...]

  30. [...] know of some database changes associated with 2.3, so I think I can safely assume some plugins aren’t going to work. [...]

  31. [...] WordPress 2.3 Database Schema Changes [...]

  32. [...] boren.nu – WordPress 2.3 Database Schema Changes [...]

  33. [...] As outras duas mudanças na base de dados são menores e com impacto quase imperceptível. Um novo status de artigo foi incluído: “pending” para artigos que estão pendentes de aprovação. E por fim alguns campos da tabela de opções também foram removidos por não estarem sendo mais usadas. Veja mais aqui. [...]

  34. [...] and restoring my SQL database, but I suggest you avoid this release. Why they decided to change the DB schema to cut off a great many things is beyond me, but I’ll stick with 2.2 for now… I suggest you [...]

  35. [...] One more thing (Jobs’ style ), it has been modified the database, in order to integrate the tags. You can see what happened here http://boren.nu/archives/2007/09/05/wordpress-23-database-schema-changes/ [...]

  36. [...] Per quanto riguarda le modifiche al database, fare riferimento a questo link http://boren.nu/archives/2007/09/05/wordpress-23-database-schema-changes/ [...]

  37. [...] WP 2.3 Database Schema Changes 2. Five step failsafe upgrade wordpress 3. WP 2.3 Themes Compatibility 4. WP 2.3 Plugins [...]

  38. [...] Sempre per documentare al meglio le novità della versione 2.3 di WordPress ecco un altro articolo di Ryan Boren sulle modifche al database [...]

  39. [...] make great pancakes (or bad ones). Among other issues (merging of categories, links and tags into a taxonomy mishmash is a whole other topic), the new built-in tagging features forces into retirement of a number of [...]

  40. [...] y “$wpdb->link2cat” como un indicador de que se usan las antiguas tablas. Más detalles y ayuda. Un archivo que haga referencia a las antiguas tablas de categorías pero también haga [...]

  41. [...] more info on the new schema, read Ryan Boren’s post [...]

  42. [...] – According to this post by Ryan Boren,  “post2cat, and link2cat tables were dropped and replaced by three new [...]

  43. [...] Ryan Boren – WordPress 2.3 Database schema changes [...]