Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




pre_schema_upgrade [ WordPress Function ]

pre_schema_upgrade ( No parameters )
Defined at:



Runs before the schema is upgraded.

Source


<?php
function pre_schema_upgrade() {
    global 
$wp_current_db_version$wp_db_version$wpdb;

    
// Upgrade versions prior to 2.9
    
if ( $wp_current_db_version 11557 ) {
        
// Delete duplicate options. Keep the option with the highest option_id.
        
$wpdb->query("DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2 USING (`option_name`) WHERE o2.option_id > o1.option_id");

        
// Drop the old primary key and add the new.
        
$wpdb->query("ALTER TABLE $wpdb->options DROP PRIMARY KEY, ADD PRIMARY KEY(option_id)");

        
// Drop the old option_name index. dbDelta() doesn't do the drop.
        
$wpdb->query("ALTER TABLE $wpdb->options DROP INDEX option_name");
    }

}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics