@@ -159,17 +159,20 @@ function get_the_link( array $attributes, array $settings = [] ): string {
159159
160160 $ attributes_escaped = [];
161161 foreach ( $ attributes as $ name => $ value ) {
162- // Use user escape function, or default
163- $ value = escape_attribute_value ( $ value , $ settings ['escape ' ][ $ name ] ?? '' );
164-
165162 // Handle single attributes like checked or data-seo-target, if null no attribute value
166- $ attributes_escaped [] = null === $ value ? $ name : sprintf ( '%s="%s" ' , $ name , $ value );
163+ if ( null === $ value ) {
164+ $ attributes_escaped [] = $ name ;
165+ } else {
166+ // Use user escape function, or default
167+ $ value = escape_attribute_value ( $ value , $ settings ['escape ' ][ $ name ] ?? '' );
168+ $ attributes_escaped [] = sprintf ( '%s="%s" ' , $ name , $ value );
169+ }
167170 }
168171
169172 // Implode all attributes for display purposes
170173 $ attributes_escaped = implode ( ' ' , $ attributes_escaped );
171174 // Escape content for display purposes
172- $ label = escape_content_value ( $ settings ['content ' ], $ settings ['escape ' ]['content ' ] ?? '' );
175+ $ label = $ settings [ ' content ' ] ? escape_content_value ( $ settings ['content ' ], $ settings ['escape ' ]['content ' ] ?? '' ) : '' ;
173176
174177 $ link_markup = sprintf ( '<a %s>%s%s</a> ' , $ attributes_escaped , $ settings ['new_window ' ], $ label );
175178
0 commit comments