Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

WordPress Attachments vs Post Meta

The WordPress “gallery” functionality partly depends on the attachment of the media to the post via the post_parent column.

Specifying IDs in your shortcode allows you to include images in your
gallery that aren’t necessarily “attached” to your post — that is to
say, not uploaded from within your post or page. This flexibility
allows you to create and embed any number of galleries containing any
number of images!

Note: If you choose to just use the “barebones” version of the
shortcode in your post or page, only images that are
“attached” to that post or page will be displayed.

http://codex.wordpress.org/Gallery_Shortcode

You can see in the source that shortcode uses get_children, which has quite a comment block in the source, and again you can see that post_parent is a key factor.

There are probably other ways to answer the questions but that is the first that comes to my mind.

Related Posts:

  1. How to set author for post AND post attachments
  2. Multi-line captions on attachments
  3. How to update the title of audio file through its attachment metadata
  4. Check whether attachment ID is associated with more than one post?
  5. getting attachement images src and add classes
  6. Are captions stored anywhere?
  7. get_the_post_thumbnail() doesn’t taking style attribute
  8. complex restriction of items in media library
  9. Remove duplicate attachments
  10. Edit image / Delete image link
  11. How could I add button next to “edit image” button in “Attachment Details”
  12. Getting attachments by meta value
  13. media_sideload_image file name?
  14. Detect if is image unattached
  15. Give attachments an archive page
  16. Insert Media – Attachment – Link to : Remove the “attachment page” option
  17. Show Post ID in “Find Posts or Pages” box in Media Library?
  18. Retrieving a custom link on an attachment
  19. Delete attachments from Front end
  20. Creating a multi-file upload form on the front end for attachments
  21. get post attachments of a particular size
  22. How to upload image from front end and save in media library?
  23. ajax delete value from custom field array
  24. Save attachment custom fields on front end
  25. Adding meta data to an attachment post
  26. How to get custom field image url of specific size
  27. How to create a CSV on the fly and send as an attachment using wp_mail?
  28. Prevent Duplicate Attachment When Using wp_insert_post
  29. Attachment 0×0 size error [closed]
  30. Contact Form 7 Data As Attachment [closed]
  31. Post Via Email – How to send Attachments with it (e.g. PDF File or JPEG Image)?
  32. How to specify width and height in the_content for image attachments
  33. Display attachment resolution size
  34. Custom Gallery HTML only working when images are attached to post/page
  35. Where does the gallery shortcode gets its attachments from?
  36. How do I link an image to the post it is attached to?
  37. media ‘path’ issue / concern when bringing files live
  38. Is it possible to share media files between multiple WordPress sites?
  39. How can I attach Facebook Open Graph data to an Attachment Page?
  40. Open the Attachment Details popup
  41. Attachment page 404
  42. Set Attachment Image File URL as GUID
  43. How to compress image before inserting to wordpress using wp_insert_attachment function?
  44. Getting “too many redirects” when using wp_redirect for attachment page
  45. Change default selection for “Embed or Link”?
  46. How can I make an attachment page for pdf uploads?
  47. Proper use of wp_get_attachment_image?
  48. Get title of post image is attached to
  49. the_time() returning wrong date/time (way in the future)
  50. Add audio attachment link to RSS
  51. Correct attachment size
  52. How to: Retrieve an attachment image from post and output it
  53. Could not get attachment using wp_mail
  54. Looking to limit file attachment downloads
  55. Echo list attachment size in post
  56. How do I intercept and modify the functionality of wp_get_attachment_image()?
  57. Front end file upload returning wrong attachment url
  58. Undoing define( ‘UPLOADS’, ”.’files’ ); to repoint to “wp-content/uploads” folder
  59. Upload image and assign it’s id to post
  60. How to get thumbnail from post attachment in this loop
  61. i want attachment.php to return the image
  62. How can I rewrite old attachment URLs?
  63. How can I customize the link when an attached image is clicked?
  64. Add a word to the first // wp_get_attachment_url // as the subdomain name
  65. Custom attachment function not working in v5.4.2?
  66. Media Library Mess After FTP … /uploads
  67. How to view exact image dimensions of a media in Admin view?
  68. Attachment metadata has value of ‘1’
  69. wp_get_attachment_image_src calling wrong location
  70. wp_delete_attachment doesn’t delete image files / doesn’t work
  71. Get attachment URL from attachment Link in WordPress
  72. Removing images deleted from uploads folder, from Media Library
  73. Send data URL string as an attachment in wp_email
  74. Display audio file in audio.php
  75. Unexpected issue when using attachment_fields_to_edit filter
  76. How to use previous/next image link, ignoring parent posts/attachments?
  77. how to add data in my custom theme from WP-Admin Panel
  78. Display setting ‘size’ not available in image settings modal
  79. Using $_FILES variable into the same function for uploading images and files
  80. Delete custom post type metadata without deleting the post in admin area
  81. Removing delete permanently button in uploading files media
  82. Retrieve ONLY mp3s and set a variable for use in a playlist called by single.php template?
  83. missing attachment are showing as 404
  84. Insert attachments from front end form
  85. How do I add Facebook OpenGraph meta tags for attachments in the header for a custom theme?
  86. Incomplete attachment page
  87. Drupal 6 to WordPress migration – media attachments
  88. How to retrieve “custom url” from image attachment in wordpress
  89. Retreive tags from attached post for media on page
  90. list of attachments: wp_get_attachment_link works, wp_get_attachment_image does not
  91. Custom attachment field dissapearing
  92. How can I let users access a specific attachment?
  93. What is the most efficient way to retrieve a group of image URL’s from different attachment ID’s of a specific crop size?
  94. How to wrap this Link with an Image?
  95. How to save media-form on custom tab
  96. open image after clicking on single.php with different stylesheet in wordpress
  97. I want to edit documents on my blog without the need to download and upload files again [closed]
  98. Open attachments in new tab/window
  99. No attachments on contact form 7
  100. wp_mail attachment not working in wordpress
Categories attachments Tags attachments, post-meta
Second tier sidebar navigation
Get the number of rows from $wpdb->get_results not working

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Disable image compression for WebP
  • At what stage does wp_ajax hooks gets applied during WordPress request?
  • How to create specific wordpress Table
  • How to get variable from other function inside class function using add_action for Ajax call
  • Some images not loading after changing IP on local wordpress install
  • search posts by POST ID
  • Elementor Contact Form Submit button has empty class
  • Duplicate Slugs on multilingual site (with Polylang)
  • Timeline from diferent wordpress api urls endpoint works, but diferent date
  • $attributes not defined in block.json PHP template for ACF blocks
© 2023 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress