Guest User

Untitled

a guest
Oct 15th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. <?php
  2. /**
  3. * clean curly quotes and other bad characters
  4. */
  5. function clean_characters($post_id) {
  6. $post_id = (int) $post_id;
  7. if (!$post_id)
  8. return;
  9. global $wpdb;
  10.  
  11. $wpdb->query('UPDATE wp_posts SET
  12. post_content = REPLACE(post_content, "’", "\'")
  13. WHERE ID = ' . $post_id);
  14. }
  15. add_action( 'save_post', 'clean_characters', 1000 );
  16. ?>
Add Comment
Please, Sign In to add comment