Make WordPress Core


Ignore:
Timestamp:
09/11/2024 11:07:26 PM (2 months ago)
Author:
peterwilsoncc
Message:

Administration: Increase frequency of heartbeat API requests.

Increases the frequency of heartbeat API requests from once every 15 seconds to once every 10 seconds.

The purpose of this change is to reduce the length of time before a post becomes unlocked as a user navigates around the WordPress Dashboard and ceases editing a post.

wp.heartbeat.interval() has been modified to allow theme and plugin authors to set the heartbeat interval to any value between one second and one hour rather than limiting them to a fixed set of values.

Props azaozz, annezazu, jorbin, kirasong.
Fixes #61960.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-form-blocks.php

    r58904 r59016  
    122122    sprintf( 'var _wpMetaBoxUrl = %s;', wp_json_encode( $meta_box_url ) ),
    123123    'before'
     124);
     125
     126// Set Heartbeat interval to 10 seconds, used to refresh post locks.
     127wp_add_inline_script(
     128    'heartbeat',
     129    'if ( window.wp && window.wp.heartbeat ) {
     130        window.wp.heartbeat.interval( 10 );
     131    }'
    124132);
    125133
Note: See TracChangeset for help on using the changeset viewer.