From 67506ccb402da63a28b1466299cb1044fbd82f3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20P=C3=B6rtner?= Date: Sat, 24 Jul 2021 15:40:32 +0200 Subject: [PATCH] Added additional post status filter. --- includes/custom-blocks/block-employees.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/custom-blocks/block-employees.php b/includes/custom-blocks/block-employees.php index 70be7f9..2a69cc9 100644 --- a/includes/custom-blocks/block-employees.php +++ b/includes/custom-blocks/block-employees.php @@ -37,9 +37,12 @@ $employees = array(); foreach ( $fields['employees'] as $employee => $employee_id ) { - $employees[$employee_id] = get_post_meta( $employee_id ); - $employees[$employee_id]['id'] = $employee_id; - $employees[$employee_id]['name'] = get_the_title( $employee_id ); + $status = get_post_status( $employee_id ); + if ($status == 'publish') { + $employees[$employee_id] = get_post_meta( $employee_id ); + $employees[$employee_id]['id'] = $employee_id; + $employees[$employee_id]['name'] = get_the_title( $employee_id ); + } } // sort by group and then by name