From 4d70c8109e58a31dd57ec81d3efa6a3800e5983d Mon Sep 17 00:00:00 2001 From: d79 <4305447+d79@users.noreply.github.com> Date: Wed, 14 Jun 2023 17:55:19 +0200 Subject: [PATCH] Added message when no posts are found When no posts are found, the rendered field is completely blank. This message, with related filter, can be useful to notify the user of the missing posts. --- init.php | 1 + 1 file changed, 1 insertion(+) diff --git a/init.php b/init.php index 3b65099..56b03b6 100644 --- a/init.php +++ b/init.php @@ -131,6 +131,7 @@ public function render( $field, $escaped_value, $object_id, $object_type, $field // If there are no posts found, just stop if ( empty( $objects ) ) { + echo apply_filters( 'cmb2_attached_posts_field_no_items_found', sprintf( '
%s
', __( 'No items found.' ) ) ); return; }