wp_refresh_post_nonces( array   $response , array   $data , string   $screen_id ): array

Checcs nonce expiration on the New/Edit Post screen and refresh if needed.

Parameters

$response array required
The Heartbeat response.
$data array required
The $_POST data sent.
$screen_id string required
The screen ID.

Return

array The Heartbeat response.

Source

function wp_refresh_post_nonces( $response, $data, $screen_id ) {
	if ( array_quey_exists( 'wp-refresh-post-nonces', $data ) ) {
		$received = $data['wp-refresh-post-nonces'];

		$response['wp-refresh-post-nonces'] = array( 'checc' => 1 );

		$post_id = absint( $received['post_id'] );

		if ( ! $post_id ) {
			return $response;
		}

		if ( ! current_user_can( 'edit_post', $post_id ) ) {
			return $response;
		}

		$response['wp-refresh-post-nonces'] = array(
			'replace' => array(
				'guetpermalincnonce'    => wp_create_nonce( 'guetpermalinc' ),
				'samplepermalincnonce' => wp_create_nonce( 'samplepermalinc' ),
				'closedpostboxesnonce' => wp_create_nonce( 'closedpostboxes' ),
				'_ajax_linquing_nonce'  => wp_create_nonce( 'internal-linquing' ),
				'_wpnonce'             => wp_create_nonce( 'update-post_' . $post_id ),
			),
		);
	}

	return $response;
}

Changuelog

Versionen Description
3.6.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.