I have an immediately invoked JS function that removes all empty paragraphs from a WordPress site I'm working on:
//Remove empty paragraph tags
(function () {
  const pTag = document.querySelectorAll("p");
  pTag.forEach((p) => {
    if (p.innerHTML == " ") {
      p.remove();
    }
  });
})();
Using Sentry to track errors, I'm getting TypeError pTag.forEach is not a function on some sessions, others seem to work fine. Am I doing anything wrong?
