Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // We need to get following code to work.
- // We need to make sure all fields is passed when clicking on the button in the "Tilbud" post type + ACF fields.
- add_action( 'post_submitbox_misc_actions', 'custom_button' );
- function custom_button( $post ){
- //Don't show button, if post type arn't tilbud
- if ('tilbud'!== $post->post_type ): return; endif;
- //Execute button to convert to order
- var_dump($post);
- ?>
- <form action="<?php admin_url('admin-post.php') ?>" method="POST">
- <!-- your inputs -->
- <input type="hidden" name="action" value="convert_to_order"/>
- <input type="submit" value="Send"/>
- </form>
- <?php }
- add_action( 'admin_post_nopriv_convert_to_order',array( "class_that_owns_that_function", 'convert_to_order_function' ) );
- function convert_to_order_function()
- {
- wp_die('hello');
- // Do what you want with $_POST variables
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement