is_product()
Checks if the current page is a product page. Conditional tag.
Uses: is_singular()
No Hooks.
Returns
true|false.
Usage
is_product();
Examples
#1 Check if the current page is the product page.
if ( is_product() ) {
echo 'This is the product page';
}
else {
echo 'This is any other page';
}
is_product() is product code WC 10.5.0
function is_product() {
return is_singular( array( 'product' ) );
}