Unable to get current product/post ID inside functions.php
-
Hi,
I’m using the following code inside functions.php to get the ID of the current product/post. But for some reason it returns nothing.
global $wp_query;
$post_id = $wp_query->post->ID;Any idea?
Thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Unable to get current product/post ID inside functions.php’ is closed to new replies.