We should ensure the error message is not translated
We should swap them to new Exception instead of trigger_error
We should wrap them in a conditional check which ensures they only get called if WP_DEBUG is defined and true
So this:
trigger_error( sprintf( __( 'Warning: The translated name for the post type %s is longer than %d characters. This *will* cause problems.', 'babble' ),
esc_html( $post_type ),
20
) );
But this:
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
throw new exception( sprintf( 'Warning: The translated name for the post type %s is longer than 20 characters. This *will* cause problems.' ), esc_html( $post_type ) );
}
Wherever we have
trigger_error
callsnew Exception
instead oftrigger_error
WP_DEBUG
is defined and trueSo this:
But this: