bp_core_current_user_ip()

Get the current user’s IP address.

Description

Return

(string) IP address.

Source

File: bp-core/bp-core-moderation.php

310
311
312
313
314
315
316
317
318
319
320
321
function bp_core_current_user_ip() {
    $retval = preg_replace( '/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR'] );
 
    /**
     * Filters the current user's IP address.
     *
     * @since BuddyPress 1.6.0
     *
     * @param string $retval Current user's IP Address.
     */
    return apply_filters( 'bp_core_current_user_ip', $retval );
}

Changelog

Changelog
Version Description
BuddyPress 1.6.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.