WordPress Replace 404 Error with 410 Gone

if ( is_404() ) {
 define( 'DONOTCACHEPAGE', true ); // WP Super Cache and W3 Total Cache recognise this
 status_header( 410 );
}