diff --git a/wpas-field.php b/wpas-field.php index 185b99c..b22f494 100644 --- a/wpas-field.php +++ b/wpas-field.php @@ -12,6 +12,7 @@ private $values; private $selected = ''; private $selected_r = array(); + private $exclude = array(); function __construct($id, $args = array()) { $defaults = array( 'label' => '', @@ -64,6 +65,15 @@ function __construct($id, $args = array()) { $this->selected_r = explode(',',$this->selected); } + // Set excluded values + if (isset($exclude)) { + if (is_array($exclude)) { + $this->exclude = $exclude; + } else { + $this->exclude[] = $exclude; + } + } + } function build_field() { @@ -123,6 +133,7 @@ function select($multi = false) { $output .= '"'.$multiple.'>'; foreach ($this->values as $value => $label) { + if (in_array($value,$this->exclude)) continue; $value = esc_attr($value); $label = esc_attr($label); $output .= '