bp_xprofile_clear_field_cache( int|BP_XProfile_Field $field )

Clear a field’s caches.

Description

Parameters

$field

(Required) A field ID or a field object.

Return

(bool) False on failure.

Source

File: bp-xprofile/bp-xprofile-cache.php

263
264
265
266
267
268
269
270
271
272
273
274
275
276
function bp_xprofile_clear_field_cache( $field ) {
    if ( is_numeric( $field ) ) {
        $field_id = (int) $field;
    } elseif ( $field instanceof BP_XProfile_Field ) {
        $field_id = (int) $field->id;
    }
 
    if ( ! isset( $field_id ) ) {
        return false;
    }
 
    wp_cache_delete( $field_id, 'bp_xprofile_fields' );
    wp_cache_delete( $field_id, 'xprofile_meta' );
}

Changelog

Changelog
Version Description
BuddyPress 2.4.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.