I have custom taxonomy term pages which I'm using to override forum pages and I want to emulate advanced forum node/add/forum/tid button so I have to get tid but don't know how, I can only find examples on how to print tid of the current node.
You can use taxonomy_get_term_by_name and use arg(3) (those are the URL args find out more about those here in the docs) or something similar to pull the name. That function should return an array of match term objects. There should be more information on the taxonomy.module docs that could help as well, you can find them here: https://api.drupal.org/api/drupal/modules%21taxonomy%21taxonomy.module/6
I have experience in D6 but not as much as D7 but something like that should work or a custom query but I'd advise against those since there is already a function for it in the API.