daily pastebin goal
43%
SHARE
TWEET

Untitled

a guest Oct 15th, 2018 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top