jQuery Ajax passing empty parameters to my function?
The values are not passed as parameters, but passed in the $_POST array. You need to add nonce for security using check_ajax_nonce https://developer.wordpress.org/reference/functions/check_ajax_referer/ You need to sanitize values submitted before inserting into database Here’s how this should be done: add_action( ‘wp_ajax_send_projectmessage’, ‘send_projectmessage’ ); function send_projectmessage() { global $wpdb; check_ajax_referer( ‘send_projectmessage’, ‘send_projectmessage_nonce’ ); $projectid = sanitize_text_field( … Read more