Guest User

Untitled

a guest
May 21st, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. $sql = mysql_query("
  2. SELECT id
  3. FROM fc_wp_posts
  4. WHERE post_type = 'post'
  5. AND post_status = 'publish'
  6. ");
  7.  
  8. while ($postname = mysql_fetch_array($sql)) {
  9. $id = $postname['id'];
  10.  
  11. $postdata = array();
  12. $postdata['ID'] = $postname['id'];
  13. $postdata['post_name'] = '';
  14.  
  15. $p = wp_update_post( $postdata );
  16. $num++;
  17. if ( is_wp_error( $p ) ) {
  18. echo 'Encountered error: ' . $p->get_error_message();
  19. } else {
  20. echo '# ' . $num . ' | Successfully updated<br />';
  21. }
  22.  
  23. }
Add Comment
Please, Sign In to add comment