How do I conditionally defer scripts based on the page name?
The global $page variable is not a WP_Post object. It is just the post ID. So to get the page title, you need to get the WP_Post object first from the post ID. The reason that defer is always getting added is two-fold. First, $page is an integer, so $page->page_name will evaluate as null and … Read more