WordPress – Add form inside post edit page

I would like to create a new metabox in the post edit page which contains a single button which should submit a form with hidden fields.

The problem is that the post edit page is a form itself – so technically I am trying to create a form inside a form and this is not possible by HTML specification.

Also, I don’t want to submit it via GET (simple link) because it must not get cached.

This is the code:

function meta_box_html()
    <form action="..." method="post">
        <input type="hidden" name="name" value="value">
        <input type="submit">

add_action("add_meta_boxes", function () {
    add_meta_box("id", "title", "meta_box_html", "post", "side", "high", null);

When I click the button – nothing happens and the page is just reloaded.

Any ideas how to add a form to post edit page?

Read more here: WordPress – Add form inside post edit page

Leave a Reply

Your email address will not be published. Required fields are marked *