{"id":1283,"date":"2013-12-05T15:56:15","date_gmt":"2013-12-05T06:56:15","guid":{"rendered":"http:\/\/www.santoshkori.com\/blog\/?p=1283"},"modified":"2013-12-05T15:56:15","modified_gmt":"2013-12-05T06:56:15","slug":"how-to-check-post-or-page-has-an-attachment-in-wordpress","status":"publish","type":"post","link":"https:\/\/www.santoshkori.com\/blog\/how-to-check-post-or-page-has-an-attachment-in-wordpress\/","title":{"rendered":"How to check post or page has an attachment in wordpress"},"content":{"rendered":"<p>Here is code to <strong><em>check post or page has an attachment in wordpress<\/em><\/strong>. You have to in wordpress loop.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\nif ( is_attachment() ) {\r\n\techo 'Has an Attachment';\r\n} else {\r\n\techo 'Not has an Attachment';\r\n}\r\n?&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Here is code to check post or page has an attachment in wordpress. You have to in wordpress loop. &lt;?php if ( is_attachment() ) { echo &#8216;Has an Attachment&#8217;; } else { echo &#8216;Not has an Attachment&#8217;; } ?&gt;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[651,650,649,725],"class_list":["post-1283","post","type-post","status-publish","format-standard","hentry","category-wordpress","tag-check-post-or-page-has-an-attachment","tag-check-post-or-page-has-an-attachment-in-wordpress","tag-how-to-check-post-or-page-has-an-attachment-in-wordpress","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts\/1283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/comments?post=1283"}],"version-history":[{"count":1,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts\/1283\/revisions"}],"predecessor-version":[{"id":1284,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts\/1283\/revisions\/1284"}],"wp:attachment":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/media?parent=1283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/categories?post=1283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/tags?post=1283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}