Title: wp_check_locked_posts
Published: April 25, 2014
Last modified: February 24, 2026

---

# wp_check_locked_posts( array $response, array $data, string $screen_id ): array

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/wp_check_locked_posts/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_check_locked_posts/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_check_locked_posts/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_check_locked_posts/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_check_locked_posts/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_check_locked_posts/?output_format=md#wp--skip-link--target)

Checks lock status for posts displayed on the Posts screen.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_check_locked_posts/?output_format=md#parameters)󠁿

 `$response`arrayrequired

The Heartbeat response.

`$data`arrayrequired

The $_POST data sent.

`$screen_id`stringrequired

The screen ID.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_check_locked_posts/?output_format=md#return)󠁿

 array The Heartbeat response.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_check_locked_posts/?output_format=md#source)󠁿

    ```php
    function wp_check_locked_posts( $response, $data, $screen_id ) {
    	$checked = array();

    	if ( array_key_exists( 'wp-check-locked-posts', $data ) && is_array( $data['wp-check-locked-posts'] ) ) {
    		foreach ( $data['wp-check-locked-posts'] as $key ) {
    			$post_id = absint( substr( $key, 5 ) );

    			if ( ! $post_id ) {
    				continue;
    			}

    			$user_id = wp_check_post_lock( $post_id );

    			if ( $user_id ) {
    				$user = get_userdata( $user_id );

    				if ( $user && current_user_can( 'edit_post', $post_id ) ) {
    					$send = array(
    						'name' => $user->display_name,
    						/* translators: %s: User's display name. */
    						'text' => sprintf( __( '%s is currently editing' ), $user->display_name ),
    					);

    					if ( get_option( 'show_avatars' ) ) {
    						$send['avatar_src']    = get_avatar_url( $user->ID, array( 'size' => 18 ) );
    						$send['avatar_src_2x'] = get_avatar_url( $user->ID, array( 'size' => 36 ) );
    					}

    					$checked[ $key ] = $send;
    				}
    			}
    		}
    	}

    	if ( ! empty( $checked ) ) {
    		$response['wp-check-locked-posts'] = $checked;
    	}

    	return $response;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-admin/includes/misc.php#L1132)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/misc.php#L1132-L1171)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_check_locked_posts/?output_format=md#related)󠁿

| Uses | Description | 
| [get_avatar_url()](https://developer.wordpress.org/reference/functions/get_avatar_url/)`wp-includes/link-template.php` |

Retrieves the avatar URL.

  | 
| [wp_check_post_lock()](https://developer.wordpress.org/reference/functions/wp_check_post_lock/)`wp-admin/includes/post.php` |

Determines whether the post is currently being edited by another user.

  | 
| [current_user_can()](https://developer.wordpress.org/reference/functions/current_user_can/)`wp-includes/capabilities.php` |

Returns whether the current user has the specified capability.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [get_userdata()](https://developer.wordpress.org/reference/functions/get_userdata/)`wp-includes/pluggable.php` |

Retrieves user info by user ID.

  | 
| [absint()](https://developer.wordpress.org/reference/functions/absint/)`wp-includes/load.php` |

Converts a value to non-negative integer.

  | 
| [get_option()](https://developer.wordpress.org/reference/functions/get_option/)`wp-includes/option.php` |

Retrieves an option value based on an option name.

  |

[Show 5 more](https://developer.wordpress.org/reference/functions/wp_check_locked_posts/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_check_locked_posts/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_check_locked_posts/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_check_locked_posts%2F)
before being able to contribute a note or feedback.