无法在自定义 metabox textarea wordpress 中显示值

Can't display the value in custom metabox textarea wordpress

好吧,我尝试在页面和帖子中制作自定义元框... 我确实有我需要在那些特定的帖子和页面上制作的滑块标题和内容.. 我确实在输入框中保存了标题部分的值.. 在内容部分,我使用了 Textarea,我的价值根本没有出现..

当我打印需要存在的变量时,我发现该值正在保存,但它没有显示

对于代码:

<?php function xgr_settings() {
add_meta_box( 
    'extra-slider-settings', // $id
     __( 'Extra Slider Settings', 'xgr' ), // $title
     'xgr_add_slider_options_callback',// $callback
      array('post','page'),
      'normal', // $context
       'high' // $priority
       );

}
add_action( 'add_meta_boxes', 'xgr_settings' );


$xgr_settings = array(         
    'slider-heading' => array(
                            'name'  => __('Slider Heading','xgr'),
                            'value' => 'slider-heading',
                            'id'    => 'slider-heading'
                        ),
    'slider-content' => array(
                            'name'  => __('Slider Content','xgr'),
                            'value' => 'slider-content',
                            'id'    => 'slider-content'
                        ),

);

function xgr_add_slider_options_callback($post){ 
global $post , $xgr_settings;

?>
<div class="metabox">
    <div class="row">
    <?php foreach($xgr_settings as $field) { 
        $headings= get_post_meta($post->ID,$field['id'],true);
        var_dump($headings);
        ?>
        <?php if(($field['id']) === 'slider-heading') { ?>
        <div class="form-group">
            <label style="margin-bottom: 9px; font-style: italic; padding: 15px 10px; line-height: 1.3; vertical-align: middle;" class="control-label f13" for="inputDefault"><?php echo esc_attr( $field['name'] ); ?></label>
            <input style="width:100%" type="text" class="form-control" id="<?php echo esc_attr( $field['id'] ); ?>" name="<?php echo esc_attr( $field['value'] ); ?>" value="<?php echo $headings ? $headings : '' ?>">
        </div>
        <?php 
        } elseif(($field['id']) === 'slider-content'){ ?>

        <div class="form-group">
            <label style="margin-bottom: 9px; font-style: italic; padding: 15px 10px; line-height: 1.3; vertical-align: middle;" class="control-label f13" for="inputDefault"><?php echo esc_attr( $field['name'] ); ?></label>
            <textarea style="width:100%;min-height:200px;" type="textarea" class="form-control" id="<?php echo esc_attr( $field['id'] ); ?>" name="<?php echo esc_attr( $field['value'] ); ?>" value="<?php echo $headings ? $headings : '' ?>"></textarea>
        </div>
        <?php } } ?>
        <br>

    </div>
</div>
<?php
wp_nonce_field( 'xgr_nonce', 'xgr_nonce' );
}
function xgr_save_funtions($post_id){

$heading = sanitize_text_field( $_POST['slider-heading']);
$content = sanitize_text_field( $_POST['slider-content']);

if(isset($POST['xgr_nonce']) && wp_verify_nonce( $POST['xgr_nonce'], 'xgr_nonce')){
    return;
}

if(isset($_POST['slider-heading'])){
    update_post_meta($post_id ,'slider-heading',$heading);
}
if(isset($_POST['slider-content'])){
    update_post_meta($post_id ,'slider-content',$content);
}

}

add_action('save_post','xgr_save_funtions');

TextArea 标签没有 value="" 参数

使用:

<textarea>{YOUR VALUE TO SHOW}</textarea>


<textarea style="width:100%;min-height:200px;" type="textarea" class="form-control" id="<?php echo esc_attr( $field['id'] ); ?>" name="<?php echo esc_attr( $field['value'] ); ?>" ><?php echo $headings ? $headings : '' ?></textarea>