(string) $message, 'type' => in_array( $type, array( 'success', 'error', 'warning', 'info' ), true ) ? $type : 'info', 'details' => array_slice( array_map( 'strval', $details ), 0, 200 ), ); set_transient( self::key(), $queue, 5 * MINUTE_IN_SECONDS ); } /** * Print and clear queued notices. * * @return void */ public static function render() { $queue = get_transient( self::key() ); if ( ! is_array( $queue ) ) { return; } delete_transient( self::key() ); foreach ( $queue as $notice ) { printf( '
%s
', esc_attr( $notice['type'] ), esc_html( $notice['message'] ) ); if ( ! empty( $notice['details'] ) ) { echo '