You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add comment status functions and Site Health integration
- Add get_current_comment_status() method returning simple status string
- Add get_detailed_comment_status() method returning comprehensive status array
- Integrate plugin status into WordPress Site Health Info panel
- Add comprehensive error handling with try-catch blocks and safe defaults
- Include total comments count, network settings, and role exclusion data
- Update README.md with complete documentation and usage examples
- Add docs directory to .distignore for distribution exclusion
Features:
- Simple status: 'all', 'posts', 'pages', 'posts,pages', 'multiple', 'none'
- Detailed status: 14 data points including API restrictions and role exclusions
- Automatic Site Health integration in Tools > Site Health > Info
- Robust error handling for edge cases and uninitialized states
- Performance optimized with single data collection method
The plugin provides two methods to programmatically check the current comment disable configuration:
14
+
15
+
### `get_current_comment_status()`
16
+
17
+
Returns a simple string indicating the current comment disable status.
18
+
19
+
**Return Values:**
20
+
21
+
-`'all'` - Comments disabled site-wide for all content types
22
+
-`'posts'` - Comments disabled only for blog posts
23
+
-`'pages'` - Comments disabled only for pages
24
+
-`'posts,pages'` - Comments disabled for both posts and pages
25
+
-`'multiple'` - Comments disabled for multiple specific content types
26
+
-`'none'` - Comments enabled everywhere
27
+
- Custom post type name (e.g., `'product'`) - Comments disabled for that specific post type
28
+
29
+
### `get_detailed_comment_status()`
30
+
31
+
Returns a comprehensive array with complete plugin configuration details including disabled post types, API restrictions, network settings, role exclusions, and comment counts.
32
+
33
+
**Key Array Elements:**
34
+
35
+
-`status` - Main status string (same as above method)
36
+
-`disabled_post_types` - Array of disabled post type slugs
37
+
-`total_comments` - Total number of comments in database
38
+
-`network_active` - Whether plugin is network activated
39
+
-`xmlrpc_disabled` / `rest_api_disabled` - API restriction status
40
+
-`role_exclusion_enabled` - Whether role-based exclusions are active
**Note:** Call these methods on or after the `init` hook to ensure proper plugin initialization.
62
+
63
+
## Site Health Integration
64
+
65
+
Plugin status is automatically displayed in **Tools > Site Health > Info > Disable Comments** section, providing administrators with a complete overview of all plugin settings including comment counts, disabled post types, API restrictions, and network configuration. No additional setup required.
66
+
11
67
## Must-Use version
12
68
13
69
A [must-use version](https://github.com/WPDevelopers/disable-comments-mu) of the plugin is also available.
14
70
15
-
### This plugin is maintained by the [WPDeveloper](https://wpdeveloper.com/).
71
+
### This plugin is maintained by the [WPDeveloper](https://wpdeveloper.com/)
0 commit comments