Insert Data into Database

You can handle that with sending the form to the script admin-post.php with that in the form : <form method=”POST” action=”<?php echo admin_url(“admin-post.php”);?>?action=myPlugin__save_datas”> after that, you use this hook for the PHP treatment add_action(“admin_init”, function () { if ( !isset($_POST[“action”]) || (“myPlugin__save_datas” !== $_POST[“action”]) ) { return; } // save datas // … // redirection … Read more

Headers already sent on custom plugin (Export function)

You are probably executing your process_bulk_action function in template where some html and headers are already sent. You have to use handle_bulk_actions-edit-post hook to execute your code before any content is sent. This might look something like that: function wpse_287406_register_export_option($bulk_actions) { $bulk_actions[‘export_csv’] = __( ‘Export to CSV’); return $bulk_actions; } add_filter( ‘bulk_actions-edit-post’, ‘wpse_287406_register_export_option’ ); function … Read more