← Back to All Snippets

Throttle WordPress Heartbeat API Frequency to 60 Seconds

⚡ Target: functions.php 🔒 Tested: WP 6.6+ / PHP 8.2+ 💻 Lang: PHP
PHP (functions.php)
add_filter( 'heartbeat_settings', function( $settings ) {
    $settings['interval'] = 60; // Set interval in seconds (default is 15)
    return $settings;
} );

Reduces high CPU usage from admin-ajax.php by slowing down the background Heartbeat API frequency from 15s to 60s in the post editor.

← Back to All Snippets Explore Dev Tools →