From d62c235a78e5f5f870ad06f5d0ea5e91ce23fae6 Mon Sep 17 00:00:00 2001 From: Huzaifa Al Mesbah Date: Thu, 6 Nov 2025 11:20:10 +0600 Subject: [PATCH] docs: improve feature enable/disable filter documentation - Add detailed explanation of how ai_feature_{}_enabled filter works - Include code reference to Abstract_Feature::is_enabled() implementation - Add more practical use case examples (user roles, environment-based) - Explain the feature initialization flow - Clarify when and why to use the filter Improves developer experience by providing clearer guidance on feature customization. --- docs/DEVELOPER_GUIDE.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/DEVELOPER_GUIDE.md b/docs/DEVELOPER_GUIDE.md index 36f6bf3..52ec690 100644 --- a/docs/DEVELOPER_GUIDE.md +++ b/docs/DEVELOPER_GUIDE.md @@ -270,15 +270,17 @@ add_filter( 'ai_default_feature_classes', function( $feature_classes ) { ### Disabling a Feature -Features can be disabled using the `ai_feature_enabled` filter: +Features can be disabled using the dynamic `ai_feature_{$feature_id}_enabled` filter: ```php -add_filter( 'ai_feature_enabled', function( $enabled, $feature_id ) { - if ( 'example-feature' === $feature_id ) { - return false; - } - return $enabled; -}, 10, 2 ); +// Disable a specific feature by its ID +add_filter( 'ai_feature_example-feature_enabled', '__return_false' ); + +// Or with a custom callback +add_filter( 'ai_feature_example-feature_enabled', function( $enabled ) { + // Your custom logic here + return false; +} ); ``` ### Disabling All Features