In my header.php
file, I've been trying to retrieve the slug of the current page, to check it's WooCommerce Products Archive/shop page. I followed this similar question's answer, to no avail; instead of the current page's slug being returned, the first item being sold slug was returned. My questions are these:
- Why does
$post->post_name
returntest-product-magazine
, instead of the correct,shop
?
<?php
global $post;
echo "post_name: " . $post->post_name;
?>