The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End single page mobile redirect: Reply To: single page mobile redirect:


get_the_ID can only be used within a WordPress Loop. If you need to get the ID outside, check out this.

But I would handle this differently by:

  • Create a page template page-{id}.php
  • Only check for mobile

No need to check for current state from your functions on every load. Corresponding template will only load when that page loads so we off load that responsibility.