How to Refresh / Flush WordPress Permalinks

Whenever a new custom post is added through a plugin or code, WordPress permalinks usually need to be flushed. Also, that's required after transferring the site to another domain.