ap_current_user_id()

Description #

Get current user id for AnsPress profile.

This function must be used only in AnsPress profile. This function checks for user ID in queried object, hence if not in user page

Changelog #

VersionDescription
4.1.1Introduced.

Source #

File: includes/functions.php

function ap_current_user_id() {
	if ( 'user' === ap_current_page() ) {
		$query_object = get_queried_object();

		if ( $query_object instanceof WP_User ) {
			return $query_object->ID;
		}
	}

	return 0;
}

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