{"id":8991884,"date":"2017-04-04T17:13:30","date_gmt":"2017-04-04T17:13:30","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/error-on-saving-post-with-empty-gallery\/"},"modified":"2017-04-04T17:13:30","modified_gmt":"2017-04-04T17:13:30","slug":"error-on-saving-post-with-empty-gallery","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/error-on-saving-post-with-empty-gallery\/","title":{"rendered":"error on saving post with empty gallery"},"content":{"rendered":"<p>Hi Navneil,<br \/>\nI had a problem saving a post with an empty gallery.<br \/>\nIt was throwing an error:<\/p>\n<blockquote><p>Notice: Undefined index: gallery in \/Users\/***\/*****\/htdocs\/steelroots\/wp-content\/plugins\/navz-photo-gallery\/fields\/acf-photo_gallery-v4.php on line 15<\/p><\/blockquote>\n<p>so I changed line 15 in fields\/acf-photo_gallery-v4.php to include a check to see if a gallery was actually being posted:<\/p>\n<p><code>$ids = !empty($field) &amp;&amp; isset($_POST[$field_id])? $_POST[$field_id]: null;<\/code><\/p>\n<p>I hope this is helpful.<br \/>\nCheers!<\/p>\n","protected":false},"template":"","class_list":["post-8991884","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/8991884","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/8991884\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=8991884"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}