register( 'debug_status', array( 'description' => 'Report WordPress debug configuration (WP_DEBUG, WP_DEBUG_LOG, WP_DEBUG_DISPLAY) and the resolved log path and size. Read-only; does not return file contents.', 'domain' => 'core', 'capability' => 'manage_options', 'inputSchema' => array( 'type' => 'object', 'properties' => array() ), ), function () { $path = agentdesk_resolve_debug_log(); $exists = $path && file_exists( $path ) && is_file( $path ); return array( 'wp_debug' => defined( 'WP_DEBUG' ) && WP_DEBUG, 'wp_debug_log' => defined( 'WP_DEBUG_LOG' ) ? WP_DEBUG_LOG : false, 'wp_debug_display' => defined( 'WP_DEBUG_DISPLAY' ) ? WP_DEBUG_DISPLAY : null, 'log_path' => $path, 'log_exists' => (bool) $exists, 'log_size_bytes' => $exists ? filesize( $path ) : 0, ); } ); } ); /** * Resolve the debug log path (for status reporting only). * * @return string */ function agentdesk_resolve_debug_log() { if ( defined( 'WP_DEBUG_LOG' ) && is_string( WP_DEBUG_LOG ) && '' !== WP_DEBUG_LOG ) { return WP_DEBUG_LOG; } $content_dir = defined( 'WP_CONTENT_DIR' ) ? WP_CONTENT_DIR : ( defined( 'ABSPATH' ) ? ABSPATH . 'wp-content' : '' ); return $content_dir ? rtrim( $content_dir, '/\\' ) . '/debug.log' : ''; }