'adv-vis-element', 'post_status' => 'any', 'numberposts' => -1]); $options = []; $options[] = ['value' => '', 'label' => 'Please select', 'disabled' => true]; if (!empty($ave_shortcodes)) { foreach ($ave_shortcodes as $shortcode) { if ($shortcode->post_status !== 'publish') { $options[] = ['value' => $shortcode->ID, 'label' => $shortcode->post_title . ' (draft)']; } else { $options[] = ['value' => $shortcode->ID, 'label' => $shortcode->post_title]; } } } wp_localize_script('adv-vis-ele-gutenberg-shortcode', 'aveVars', ['shortcodes' => $options]); register_block_type(__DIR__); } }