Skip to content

Instantly share code, notes, and snippets.

@web-dev-media
Last active August 29, 2015 14:06

Revisions

  1. web-dev-media revised this gist Sep 8, 2014. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions clean-author-description.php
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,12 @@
    <?php
    /**
    * Plugin Name: Strip HTML from Author description
    * Plugin URI:
    * 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
    * Version: 1.0
    * Author: ../web/dev/media <[email protected]>
    * Author URI: http://www.web-dev-media.de
    * License: GPL2
    */

    /**
  2. web-dev-media created this gist Sep 8, 2014.
    27 changes: 27 additions & 0 deletions clean-author-description.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    <?php
    /**
    * Plugin Name: Strip HTML from Author description
    * Plugin URI:
    * 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' );