WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] How to use get_the_ID() in sidebar?

[Resolved] How to use get_the_ID() in sidebar?

  • I want to use get_the_ID() to get the custom fields for the page currently being viewed by the user. The problem is that get_the_ID() is not working in the sidebar.php. It only works inside the loop.

    I’m writing some PHP code in my sidebar.php that requires me to know the id of the current post.

    How am I to get?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] How to use get_the_ID() in sidebar?’ is closed to new replies.