upgrade_101

Execute changes made in WordPress 1.0.1.

Description

upgrade_101(); 

Usage

  1. if ( !function_exists( 'upgrade_101' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/upgrade.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = upgrade_101(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/upgrade.php  
  1. function upgrade_100() { 
  2. global $wpdb; 
  3.  
  4. // Get the title and ID of every post, post_name to check if it already has a value 
  5. $posts = $wpdb->get_results("SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''"); 
  6. if ($posts) { 
  7. foreach ($posts as $post) { 
  8. if ('' == $post->post_name) { 
  9. $newtitle = sanitize_title($post->post_title); 
  10. $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_name = %s WHERE ID = %d", $newtitle, $post->ID) );