1

I am building Metabox in WordPress, and I have added two TextArea with JSON Data . but When I Click on Save button than only first textarea data can be stored in database insted of both textarea.

<div class="row output-container">
                    <div class="col-md-offset-1 col-md-10">
                        <h2 class="text-center">Output:</h2>
                        <form class="form">
                            <textarea class="form-control" name="json-output" id="json-output" rows="5" style="width:100%" ><?php echo get_post_meta($post->ID, 'json-output', true);?></textarea>
                        </form>
                    </div> 
                </div>
                <div class="row output-container">
                    <div class="col-md-offset-1 col-md-10">
                        <h2 class="text-center">Output:</h2>
                        <form class="form">
                            <textarea class="form-control" name="json-output-cat" id="json-output-cat" rows="5" style="width:100%" ><?php echo get_post_meta($post->ID, 'json-output-cat', true);?></textarea>
                        </form>
                    </div>
                </div>

This is my Html code , below is WordPress Function

update_post_meta($post_id, "json-output", $_POST["json-output"]);
update_post_meta($post_id, "json-output-cat", $_POST["json-output-cat"]);

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.