Bugfixes & improvements

Some fixes & improvements:
- Use wp_update_post instead of wpdb->query
See also: https://codex.wordpress.org/Function_Reference/wp_update_post

- Fixed: php notices on single ticket page
Need to use the ```init``` hook instead of ```after_setup_theme```, otherwise you'll get on the single ticket page php notices like following:
```Notice: Trying to get property of non-object in
/wp-includes/query.php on line 3516```
```Notice: Trying to get property of non-object in /wp-includes/query.php
on line 3521```
```Notice: Trying to get property of non-object in /wp-includes/query.php
on line 3530```