Skip to content

Instantly share code, notes, and snippets.

@web-dev-media
Last active August 29, 2015 14:06
Show Gist options
  • Save web-dev-media/ec549fa9b8c91c78b53a to your computer and use it in GitHub Desktop.
Save web-dev-media/ec549fa9b8c91c78b53a to your computer and use it in GitHub Desktop.
Clean Author Description
<?php
/**
* Plugin Name: Strip HTML from Author description
* Plugin URI: https://gist.github.com/web-dev-media/ec549fa9b8c91c78b53a
* Description: Remove all HTML-Code from author description
* Version: 1.0
* Author: ../web/dev/media <[email protected]>
* Author URI: http://www.web-dev-media.de
* License: GPL2
*/
/**
* Strip all HTML from the author description
*
* @author ../web/dev/media
*/
function strip_author_html( $author_meta ) {
if( !empty( $_POST['description'] ) ){
$_POST['description'] = strip_tags( $_POST['description'] );
}else{
echo strip_tags( $author_meta );
}
}
add_filter( 'the_author_description', 'strip_author_html' );
add_action( 'edit_user_profile_update', 'strip_author_html' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment