deslash

Filters for content to remove unnecessary slashes.

Description

(string) deslash( (string) $content ); 

Returns (string)

The de-slashed content.

Parameters (1)

0. $content (string)
The content to modify.

Usage

  1. if ( !function_exists( 'deslash' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/upgrade.php'; 
  3.  
  4. // The content to modify. 
  5. $content = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = deslash($content); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/upgrade.php  
  1. function deslash($content) { 
  2. // Note: \\\ inside a regex denotes a single backslash. 
  3.  
  4. /** 
  5. * Replace one or more backslashes followed by a single quote with 
  6. * a single quote. 
  7. */ 
  8. $content = preg_replace("/\\\+'/", "'", $content); 
  9.  
  10. /** 
  11. * Replace one or more backslashes followed by a double quote with 
  12. * a double quote. 
  13. */ 
  14. $content = preg_replace('/\\\+"/', '"', $content); 
  15.  
  16. // Replace one or more backslashes with one backslash. 
  17. $content = preg_replace("/\\\+/", "\\", $content); 
  18.  
  19. return $content;