Redirect website domain (including all pages) to external URL after Popup message (few seconds)

“Where” somewhat depends on the theme you’re using. Here’s couple examples,

  1. If you have a custom made theme, then you can put the code in any appropriate place. For example header.php (after <head>) or footer.php.

  2. If you have child theme, then you can copy a suitable template_part file from the parent theme to the child dir and add the code to that file.

  3. Add the code with a action/filter hook. For example wp_footer (although the button might look a bit silly with this one) or append it to the_content.

  4. If you don’t need to show the redirected domains content, you could create custom page template and page to which you first redirect all users with template_redirect (or template_include) to serve as a landing page. Then include your custom redirect modal on that page.