Skip to content

Instantly share code, notes, and snippets.

@dnaber-de
Created August 25, 2012 11:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dnaber-de/3464269 to your computer and use it in GitHub Desktop.
Save dnaber-de/3464269 to your computer and use it in GitHub Desktop.
WP Plugin: Don't replace 'Wordpress' with 'WordPress'. Keep ' and " as they are.
<?php
/**
* Plugin Name: dna Hands off from content
* Description: Don't replace 'Wordpress' with 'WordPress'. Keep ' and " as they are.
* Plugin URI: https://gist.github.com/3464269
* Version: 2012.08.25
* Author: David Naber
* Author URI: http://dnaber.de/
* License: MIT
* License URI: http://www.opensource.org/licenses/mit-license.php
*/
namespace dna\hands_of_content;
add_action( 'plugins_loaded', __NAMESPACE__ . '\no_cap_P' );
add_action( 'plugins_loaded', __NAMESPACE__ . '\untexturize' );
/**
* remove capital_P_dangit from the content
*
* @wp-hook plugins_loaded
* @return void
*/
function no_cap_P() {
#global $wp_cockneyreplace;
foreach ( array( 'the_content', 'the_title' ) as $filter )
remove_filter( $filter, 'capital_P_dangit', 11 );
remove_filter( 'comments_text', 'capital_P_dangit', 31 );
}
/**
* replace ' and " with their entities to prevent changing them into
* real quotation-marks
*
* @wp-hook plugins_loaded
* @return void
*/
function untexturize() {
global $wp_cockneyreplace;
$wp_cockneyreplace[ "'" ] = '&#x27;';
$wp_cockneyreplace[ '"' ] = '&#x22;';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment