gpsa_storage_mode

  1. Description
  2. Usage
  3. Parameters
  4. Examples
  5. Since

Description

Allows filtering the storage mode for content access. Access can either be tracked in cookies or the current User’s Profile (the usermeta table). Note that if the current user is not logged in, access will be tracked via a cookie even if set to use User Profile.

Usage

Filter applied globally to determine storage mode

add_filter( 'gpsa_storage_mode', 'my_custom_function' );

Parameters

$storage_mode string

The default storage mode. Possible values are ‘cookie’ or ‘user_profile’.

Examples

This example shows how to change the storage mode to track access in the user’s profile instead of cookies, which provides persistent access across devices.

add_filter( 'gpsa_storage_mode', function( $storage_mode ) {
    return 'user_profile';
} );

Since

  • 1.0.0 Hook added.