How can you add a custom script that needs to run only on the contact page of a site? The slug of the page is contact.

✅  The correct answer is:

  • Link to the script directly from a template named page-contact.php, like this
  • <script src=”/my-script.js”></script>

Question:

How can you add a custom script that needs to run only on the contact page of a site? The slug of the page is contact.

Solution:

  • Link to the script directly from a template named page-contact.php, like this:
  • <script src=”/my-script.js”></script>