From 4c2d3ef871a964bd8ca164b87fa1ff8fdfe8b4c0 Mon Sep 17 00:00:00 2001 From: Michael Ilett Date: Mon, 20 Apr 2026 13:43:14 +0100 Subject: [PATCH] feat: ignore _crdt_document meta --- post-meta-inspector.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/post-meta-inspector.php b/post-meta-inspector.php index 7c24c50..9e39785 100644 --- a/post-meta-inspector.php +++ b/post-meta-inspector.php @@ -25,3 +25,27 @@ function post_meta_inspector() { return Post_Meta_Inspector::instance(); } add_action( 'plugins_loaded', 'post_meta_inspector' ); + + +/** + * Ignore the _crdt_document meta key due it's size and unhelpfulness to the user. + * + * The value of the _crdt_document is a very long string that breaks the UI of the post meta inspector when output. It + * is added in WordPress 7.0 to track the document state of collaborative editing. + * + * @see https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/post.php#L8679 + * + * @param bool $ignore Whether to ignore the meta key. + * @param string $meta_key The meta key being evaluated. + * + * @return bool Whether to ignore the meta key. + */ +function pmi_ignore_crdt_document( $ignore, $meta_key ) { + if ( $meta_key === '_crdt_document' ) { + return true; + } + + return $ignore; +} +add_filter( 'pmi_ignore_post_meta_key', 'pmi_ignore_crdt_document', 10, 2 ); +