diff --git a/src/Telemetry/Opt_In/Opt_In_Template.php b/src/Telemetry/Opt_In/Opt_In_Template.php index cf23af6..30cc842 100644 --- a/src/Telemetry/Opt_In/Opt_In_Template.php +++ b/src/Telemetry/Opt_In/Opt_In_Template.php @@ -133,6 +133,22 @@ public function get_option_name( string $stellar_slug ) { $stellar_slug ); + /** + * Filters the name of the option stored in the options table. + * This filter can be used to apply a generic option name. + * Usage of this filter is highly discouraged. + * + * @since 2.3 + * + * @param string $option_name + * @param string $stellar_slug The current stellar slug. + */ + $option_name = apply_filters( + 'stellarwp/telemetry/show_optin_option_name', + $option_name, + $stellar_slug + ); + /** * Filters the name of the option stored in the options table. * diff --git a/tests/wpunit/TemplateTest.php b/tests/wpunit/TemplateTest.php index d2ff603..5392690 100644 --- a/tests/wpunit/TemplateTest.php +++ b/tests/wpunit/TemplateTest.php @@ -117,6 +117,7 @@ static function ( string $_template_file, bool $require_once, array $args ) use public function test_get_option_name() { $template = Config::get_container()->get( Opt_In_Template::class ); + $this->assertSame( 'stellarwp_telemetry_show_optin', $template->get_option_name( self::PLUGIN_SLUG ) ); $this->assertSame( 'stellarwp_telemetry_' . self::PLUGIN_SLUG . '_show_optin', $template->get_option_name( self::PLUGIN_SLUG ) ); }