Introduction
Elementor v3.1.0 introduces a new way to handle features that are during their experimental phase.
Each experimental feature has several properties that represent different aspects of the feature:
Feature Properties
Property | Default | Possible Values |
name : string The name of the feature | N/A | feature_name_slug |
title : string The title that will be shown in the Experiments Dashboard | N/A | Free text |
description : string The description that will be shown in the Experiments Dashboard | Empty string | Free text |
release_status : string Status of the release that will be shown in the Experiments Dashboard | Experiments\Manager::RELEASE_STATUS_ALPHA | One of Experiments\Manager statuses* |
state : string Read-only. The state of the feature defined by the user in the dashboard | Experiments\Manager::STATE_DEFAULT | One of Experiments\Manager states** |
default : string The default state of the feature, as long as the user has not changed it | Experiments\Manager::STATE_INACTIVE | One of Experiments\Manager states** |
on_state_change : callback Callback to run when the feature state has been changed by the user | null | A callback |
* Experiments\Manager
statuses are:
Experiments\Manager::RELEASE_STATUS_DEV
Experiments\Manager::RELEASE_STATUS_ALPHA
Experiments\Manager::RELEASE_STATUS_BETA
Experiments\Manager::RELEASE_STATUS_RC
Experiments\Manager::RELEASE_STATUS_STABLE
** Experiments\Manager
states are:
Experiments\Manager::STATE_DEFAULT
Experiments\Manager::STATE_ACTIVE
Experiments\Manager::STATE_INACTIVE
The full Experiments\Manager
class name is Elementor\Core\Experiments\Manager
.
Registering a feature
You can add your feature by listening to elementor/experiments/default-features-registered
hook:
use Elementor\Core\Experiments\Manager as Experiments_Manager;
add_action( 'elementor/experiments/default-features-registered', function( Experiments_Manager $experiments_manager ) {
$experiments_manager->add_feature( [
'name' => 'my-feature',
'title' => 'My Feature',
'description' => 'This is an experimental feature. Use it if you dare!',
'release_status' => Experiments_Manager::RELEASE_STATUS_BETA,
'default' => Experiments_Manager::STATE_ACTIVE,
] );
} );
Now you will be able to see your feature in the Experiments dashboard:
