Changeset 3259357
- Timestamp:
- 03/20/2025 05:59:38 PM (12 months ago)
- Location:
- turn-comments-off
- Files:
-
- 6 edited
- 1 copied
-
tags/2.0.0 (copied) (copied from turn-comments-off/trunk)
-
tags/2.0.0/LICENSE (modified) (1 diff)
-
tags/2.0.0/plugin.php (modified) (3 diffs)
-
tags/2.0.0/readme.txt (modified) (2 diffs)
-
trunk/LICENSE (modified) (1 diff)
-
trunk/plugin.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
turn-comments-off/tags/2.0.0/LICENSE
r2889508 r3259357 1 1 Turn Comments Off plugin for WordPress 2 2 3 Copyright 2022-202 3, Happy Prime and contributors3 Copyright 2022-2025, Happy Prime and contributors 4 4 5 5 This program is free software; you can redistribute it and/or modify -
turn-comments-off/tags/2.0.0/plugin.php
r3124314 r3259357 3 3 * Plugin Name: Turn Comments Off 4 4 * Description: Turn comments off everywhere in WordPress. 5 * Version: 1.3.25 * Version: 2.0.0 6 6 * Plugin URI: https://github.com/happyprime/turn-comments-off/ 7 7 * Author: Happy Prime … … 39 39 add_filter( 'get_comments_number', '__return_zero' ); 40 40 41 // So return an empty set o f comments for all comment queries.42 add_filter( 'comments_pre_query', '__return_empty_array');41 // So return an empty set or count of comments for all comment queries. 42 add_filter( 'comments_pre_query', __NAMESPACE__ . '\filter_comments_pre_query', 10, 2 ); 43 43 44 44 // And disable the comments feed. … … 63 63 add_action( 'load-options-discussion.php', __NAMESPACE__ . '\block_comments_admin_screen' ); 64 64 add_action( 'load-edit-comments.php', __NAMESPACE__ . '\block_comments_admin_screen' ); 65 66 /** 67 * Filter the comments pre query. 68 * 69 * @param array<int,\WP_Comment>|int|null $comments The comments to filter. 70 * @param \WP_Comment_Query $query The query object. 71 * @return array<int,\WP_Comment>|int The filtered comments. 72 */ 73 function filter_comments_pre_query( $comments, \WP_Comment_Query $query ) { 74 if ( $query->query_vars['count'] ) { 75 return 0; 76 } 77 78 return []; 79 } 65 80 66 81 /** -
turn-comments-off/tags/2.0.0/readme.txt
r3182834 r3259357 4 4 Requires at least: 5.9 5 5 Tested up to: 6.7 6 Stable tag: 1.3.26 Stable tag: 2.0.0 7 7 License: GPLv2 or later 8 8 Requires PHP: 7.4 … … 28 28 29 29 ## Changelog 30 31 ### 2.0.0 32 33 * Fix a fatal PHP error when a comment query requests a count. 34 * Note: If you had manually removed our `comments_pre_query` filter for any reason, 35 (you likely weren't), you'll need to adjust your code to account for the new 36 namespaced function. 37 * Update development dependencies. 30 38 31 39 ### 1.3.2 -
turn-comments-off/trunk/LICENSE
r2889508 r3259357 1 1 Turn Comments Off plugin for WordPress 2 2 3 Copyright 2022-202 3, Happy Prime and contributors3 Copyright 2022-2025, Happy Prime and contributors 4 4 5 5 This program is free software; you can redistribute it and/or modify -
turn-comments-off/trunk/plugin.php
r3124314 r3259357 3 3 * Plugin Name: Turn Comments Off 4 4 * Description: Turn comments off everywhere in WordPress. 5 * Version: 1.3.25 * Version: 2.0.0 6 6 * Plugin URI: https://github.com/happyprime/turn-comments-off/ 7 7 * Author: Happy Prime … … 39 39 add_filter( 'get_comments_number', '__return_zero' ); 40 40 41 // So return an empty set o f comments for all comment queries.42 add_filter( 'comments_pre_query', '__return_empty_array');41 // So return an empty set or count of comments for all comment queries. 42 add_filter( 'comments_pre_query', __NAMESPACE__ . '\filter_comments_pre_query', 10, 2 ); 43 43 44 44 // And disable the comments feed. … … 63 63 add_action( 'load-options-discussion.php', __NAMESPACE__ . '\block_comments_admin_screen' ); 64 64 add_action( 'load-edit-comments.php', __NAMESPACE__ . '\block_comments_admin_screen' ); 65 66 /** 67 * Filter the comments pre query. 68 * 69 * @param array<int,\WP_Comment>|int|null $comments The comments to filter. 70 * @param \WP_Comment_Query $query The query object. 71 * @return array<int,\WP_Comment>|int The filtered comments. 72 */ 73 function filter_comments_pre_query( $comments, \WP_Comment_Query $query ) { 74 if ( $query->query_vars['count'] ) { 75 return 0; 76 } 77 78 return []; 79 } 65 80 66 81 /** -
turn-comments-off/trunk/readme.txt
r3182834 r3259357 4 4 Requires at least: 5.9 5 5 Tested up to: 6.7 6 Stable tag: 1.3.26 Stable tag: 2.0.0 7 7 License: GPLv2 or later 8 8 Requires PHP: 7.4 … … 28 28 29 29 ## Changelog 30 31 ### 2.0.0 32 33 * Fix a fatal PHP error when a comment query requests a count. 34 * Note: If you had manually removed our `comments_pre_query` filter for any reason, 35 (you likely weren't), you'll need to adjust your code to account for the new 36 namespaced function. 37 * Update development dependencies. 30 38 31 39 ### 1.3.2
Note: See TracChangeset
for help on using the changeset viewer.