Writing a custom excerpt function

The easiest way is to use strip_tags().

// Remove all html from the excerpt.
function custom_excerpt( $text ) {
    return strip_tags( $text );
}
add_filter( 'the_excerpt', 'custom_excerpt' );

If you want to get fancy and trim the excerpt length, you can use this function.

// Trim default excerpt length from 55 chars to 20. 
function custom_excerpt_length( $length ) {
    return 20;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 99 );

error code: 523