Last active
          November 23, 2016 12:12 
        
      - 
      
- 
        Save joeldrapper/3122047dc0611898c769 to your computer and use it in GitHub Desktop. 
    Cleanup WordPress
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function cleanup () { | |
| var textContent = jQuery('.wp-editor-area').val(); | |
| textContent = textContent | |
| .replace(/(\<center\>)(["a-z,.!?':;@£$%=\[\]{}^&*()_”“–—‘’\-\+0-9 \n]*)(\<\/center\>)/ig, "<blockquote>$2</blockquote>") | |
| .replace(/(\<img.+\/\>)/g, "\n\n") | |
| .replace(/(\<i\>)(.*)(\<\/i\>)/g, "<em>$2</em>") | |
| .replace(/(\<b\>)(.*)(\<\/b\>)/g, "<strong>$2</strong>"); | |
| jQuery('.wp-editor-area').val(textContent); | |
| }; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment