diff --git a/gp-entry-blocks/gpeb-remove-fields-on-edit.php b/gp-entry-blocks/gpeb-remove-fields-on-edit.php index d83a308be..015bdae7f 100644 --- a/gp-entry-blocks/gpeb-remove-fields-on-edit.php +++ b/gp-entry-blocks/gpeb-remove-fields-on-edit.php @@ -31,6 +31,21 @@ function gpeb_remove_fields_on_edit( $form ) { if ( strpos( $field->cssClass, 'gpeb-remove-on-edit' ) !== false ) { $field->visibility = 'administrative'; } + + // For pages, we add conditional logic if its marked for removal. + if ( $field->type == 'page' && strpos( $field->cssClass, 'gpeb-remove-on-edit' ) !== false ) { + $field->conditionalLogic = array( + 'actionType' => 'show', + 'logicType' => 'all', + 'rules' => array( + array( + 'fieldId' => 9999, // A dummy field ID that will never match. + 'operator' => 'is', + 'value' => 'hide' + ) + ) + ); + } } return $form;