Skip to main content

benecaster_setup_wizard_steps

Filter Free Since v1.0.0

Filters the ordered array of step definitions passed to the Setup Wizard before the wizard shell is rendered. Add-ons use this filter to inject custom configuration steps, reorder existing steps, or conditionally remove steps based on site state.

Each step definition requires four keys: `id` (a unique slug used in completion tracking), `component` (the registered React component name), `required` (whether the step can be skipped), and `condition` (an optional state flag that must be true for the step to appear). Unrecognised condition strings default to false, so steps are safely hidden until their flag-setting logic is deployed. Core step IDs for positioning: `show-name`, `description`, `artwork`, `category`, `subscription`, `tiers`, `migration`, `import`, `all-done`.

Parameters

Name Type Default Description
$steps array Ordered array of step definition arrays

Returns: array

Examples

Inject step after RSS step

add_filter( 'benecaster_setup_wizard_steps', function( $steps ) {
    // Inject a custom "Analytics" step after the "RSS" step.
    $position = array_search( 'rss', array_column( $steps, 'id' ), true );
    $new_step = [ 'id' => 'analytics', 'label' => 'Analytics Setup', 'add_on' => 'my-analytics-addon' ];
    array_splice( $steps, $position !== false ? $position + 1 : count( $steps ), 0, [ $new_step ] );
    return $steps;
} );

Inject bridge-conditional step

add_filter( 'benecaster_setup_wizard_steps', function ( array $steps ): array {
    $insert_after = array_search( 'subscription', array_column( $steps, 'id' ), true );

    if ( false !== $insert_after ) {
        array_splice( $steps, $insert_after + 1, 0, [[
            'id'        => 'my-addon-config',
            'component' => 'MyAddonWizardStep',
            'required'  => false,
            'condition' => 'bridge_connected',
        ]] );
    }

    return $steps;
} );

Notes

Use array_search on array_column( $steps, 'id' ) to find the insertion point, then array_splice to insert. Always return the modified array. Unrecognised condition strings default to false — it is safe to deploy a step before its flag-setting logic exists. The bridge_connected condition flag is set when the user selects a membership plugin in the Subscription step.

Affects

  • Setup Wizard