I have a custom meta box created using Rilwis meta box script(http://www.deluxeblogtips.com/meta-box/) inside my theme functions.php.
It has 2 text fields, one field is required to fetch results from api, so, it needs to be visible on the custom meta box. But, the other field stores a serialized array which is the response fetched from external api. So, I want to make this field hidden.
Please tell me how can I hide the other field. Here is the code which defines the two text fields:
if (!class_exists('F8_Stores')) { class F8_Stores { private $fields = array(); private $validation = array(); private $prefix = 'f8_'; public function __construct() { add_action('admin_init', array($this, 'register_store_meta_box')); } public function register_store_meta_box() { $this -> fields = $this -> add_custom_fields(); $this -> validation = $this -> add_validation_rules(); $meta_box = array('id' => 'f8_stores', 'title' => 'Online Retail Stores', 'pages' => array('post', 'page'), 'context' => 'normal', 'priority' => 'high', 'fields' => $this -> fields, 'validation' => $this -> validation); new RW_Meta_Box($meta_box); } private function add_custom_fields() { $fields = array( array('name' => 'Amazon US Product ASIN', 'desc' => 'Please enter product ASIN', 'id' => $this -> prefix . 'amazon_us_asin', 'type' => 'text', 'std' => false, 'clone' => false, ), array('name' => 'Amazon US Store Cache', 'desc' => 'Users should not see this', 'id' => '_' . $this -> prefix . 'amazon_us_store_cache', 'type' => 'text', 'clone' => false, ), ); echo $fields[1]['id']; return $fields; } private function add_validation_rules() { $validation = array(); return $validation; } } } $F8_Stores = new F8_Stores();
I am using this inside a class, and despite adding '_'in front of 'id' of text field 2, the field is still visible inside metabox. Don't know what I am missing?
Any help is appreciated...thanks!
P.S. I am using Rilwis Meta Box 4.2.3 and Wordpress 3.5 running on xampp.
Update: I have now posted my actual class responsible for generating metabox. Update: Thanks everyone for response, the problem is now fixed.