Created
August 25, 2012 11:43
-
-
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.
This file contains 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
<?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[ "'" ] = '''; | |
$wp_cockneyreplace[ '"' ] = '"'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment