ap_user_link_anchor( string $user_id, boolean $echo = true )

Description #

User name and link with anchor tag.

Parameters #

  • $user_id
    string (Required) User ID.
  • $echo
    boolean (Optional) Echo or return. Default value: true

Source #

File: includes/functions.php

function ap_user_link_anchor( $user_id, $echo = true ) {
	$name = ap_user_display_name( $user_id );

	if ( $user_id < 1 ) {
		if ( $echo ) {
			echo $name; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
		} else {
			return $name;
		}
	}

	$html  = '<a href="' . esc_url( ap_user_link( $user_id ) ) . '">';
	$html .= $name;
	$html .= '</a>';

	if ( $echo ) {
		echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
	}

	return $html;
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment