Filter hook 'thread_comments_depth_max'

in WP Core File wp-admin/options-discussion.php at line 111

View Source

thread_comments_depth_max

Filter Hook
Description
Filters the maximum depth of threaded/nested comments.

Hook Information

File Location wp-admin/options-discussion.php View on GitHub
Hook Type Filter
Line Number 111

Hook Parameters

Type Name Description
int $max_depth The maximum depth of threaded comments. Default 10.

Usage Examples

Basic Usage
<?php
// Hook into thread_comments_depth_max
add_filter('thread_comments_depth_max', 'my_custom_filter', 10, 1);

function my_custom_filter($max_depth) {
    // Your custom filtering logic here
    return $max_depth;
}

Source Code Context

wp-admin/options-discussion.php:111 - How this hook is used in WordPress core
<?php
 106   *
 107   * @since 2.7.0
 108   *
 109   * @param int $max_depth The maximum depth of threaded comments. Default 10.
 110   */
 111  $maxdeep = (int) apply_filters( 'thread_comments_depth_max', 10 );
 112  
 113  $thread_comments_depth = '<select name="thread_comments_depth" id="thread_comments_depth">';
 114  for ( $i = 2; $i <= $maxdeep; $i++ ) {
 115  	$thread_comments_depth .= "<option value='" . esc_attr( $i ) . "'";
 116  	if ( (int) get_option( 'thread_comments_depth' ) === $i ) {

PHP Documentation

<?php
/**
 * Filters the maximum depth of threaded/nested comments.
 *
 * @since 2.7.0
 *
 * @param int $max_depth The maximum depth of threaded comments. Default 10.
 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-admin/options-discussion.php
Related Hooks

Related hooks will be displayed here in future updates.