Um, yeah, there’s several things wrong ??
One is your function is passed a post object, not a query object. Sure, $query is just a label and can be used, but it confuses my feeble brain. I can think better if it were $post. OK, that one is not technically wrong, just confusing.
Two, you are using the assignment operator ‘=’ inside the if() parameter, which can have it’s place, but we normally see the equivalence operator ‘==’ used in this situation.
Third, you are using a query syntax for the if() parameter, nice try, but if() does not understand it. It needs some help. First get the categories using wp_get_post_categories() and assign the result to a variable. Then you can use the in_array() function as if() parameters.
You can logically connect if parameters with the AND operator ‘&&’. So you end up with the first part like this:
function add_point($post) {
$cats = wp_get_categories($post->ID);
if(in_array(2, $cats) && in_array(3, $cats)) {
// do the rest
Fourth, your connection variable $con is now out of scope and your update query will fail. Either establish the connection as a global or initiate the connection within the function’s scope. If your table is in the same DB as WP, you can use the global $wpdb connection object, which has its own methods, to run your update query.
Finally, you may want to collect the query return value and throw some sort of error if it fails. Not required if failure is of no consequence.
Try addressing these issues and see if it works for you. Good luck!