Home › Forums › General Issues › Give body a class based on true/false checkbox › Reply To: Give body a class based on true/false checkbox
get_the_ID() can only be used inside the loop, see the WP Codex
Using this function for the <body> tag would usually be outside the loop, so there is no telling what value is actually being returned.
When you’re assigning classes you’ll need to get the post id using some other method.
I’d probably use is_single() and/or possibly get_queried_object()
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.