admin管理员组

文章数量:1291095


I am trying to trigger the echo when the form button will click. but not able to do this. if I don't use form and direct echo there. this is working. but when I use a form, it's not working.

can anyone help me with this?

<?php
add_action( 'add_meta_boxes', 'meta_box_cusotm_buttons' );
function meta_box_cusotm_buttons(){                                      // --- Parameters: ---
    add_meta_box( 
        'sync-with-server-metabox', // ID attribute of metabox
        'Server Action',       // Title of metabox visible to user
        'meta_box_callback', // Function that prints box in wp-admin
        'website',              // Show box for posts, pages, custom, etc.
        'side',            // Where on the page to show the box
        'high' // Priority of box in display order
    );            
}

function meta_box_callback( $post ){

    if(isset($_POST['connectToServer'])){

        echo 'Hello';
        
    }

    ?>
    <form action="" method="post">
        <input name="connectToServer" type="submit" value="submit" />
    </form>

    <?php   
}

本文标签: hooksHow to use custom form on addmetaboxes callback