protected function _build_controls() { $this->_add_control('_header', ['description' => $this->description, 'label' => $this->label], 'Header'); $this->manager->add_setting("{$this->id}[post_id]", ['type' => 'option', 'transport' => 'postMessage']); add_action("customize_save_{$this->_panel}", function ($setting) { if ($setting->id == "{$this->id}[post_id]") { $this->_save_post_id($setting); } }); $control = new \WP_Customize_Control($this->manager, "{$this->id}[post_id]", ['type' => 'hidden', 'section' => $this->section, 'input_attrs' => ['style' => 'width: 100%;', 'data-post_type' => isset($this->post_type) ? $this->post_type : 'post', 'data-placeholder' => __('— Select —')]]); $control->input_attrs['data-value'] = get_the_title($control->value()); $this->manager->add_control($control); }