Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
<?php /** * fixing utf8 post name */ /** Sets up the WordPress Environment. */ require( dirname(__FILE__) . '/wp-load.php' ); $posts_to_fix = $wpdb->get_results("SELECT ID, post_name FROM $wpdb->posts"); foreach ($posts_to_fix as $fix) { echo "fixing: $fix->ID\n"; $name = sanitize_title($fix->post_name); $wpdb->query(" UPDATE $wpdb->posts SET post_name = '$name' WHERE ID = " . $fix->ID); } ?>
This paste will be private.
From the Design Piracy series on my blog: