Is there a way to hook into the WPDB instance ($wpdb)? What i basically want, is to execute a own function BEFORE the desired query get's executed. Is this possible? # Additional question for comment to first answer: $query = $wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "test WHERE type = %s and ip = %s", $type, $ip_full_log); $fetch = $wpdb->get_results($query, ARRAY_A); Would this parse the final query to my callback function?