Home » Wordpress » How to check post or page has an attachment in wordpress

Here is code to check post or page has an attachment in wordpress. You have to in wordpress loop.

<?php
if ( is_attachment() ) {
	echo 'Has an Attachment';
} else {
	echo 'Not has an Attachment';
}
?>

Array ( [0] => Wordpress )