wpseek.com
A WordPress-centric search engine for devs and theme authors



_wp_connectors_mask_api_key › WordPress Function

Since7.0.0
Deprecatedn/a
_wp_connectors_mask_api_key ( $key )
Access:
  • private
Parameters:
  • (string) $key The API key to mask.
    Required: Yes
Returns:
  • (string) The masked key, e.g. "************fj39".
Defined at:
Codex:

Masks an API key, showing only the last 4 characters.



Source

function _wp_connectors_mask_api_key( string $key ): string {
	if ( strlen( $key ) <= 4 ) {
		return $key;
	}

	return str_repeat( "\u{2022}", min( strlen( $key ) - 4, 16 ) ) . substr( $key, -4 );
}