Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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 <info@web-dev-media.de>
* 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