try get_pages with
'child_of' => get_the_ID(),
'parent' => get_the_ID(),
If you need i can post full code
EDIT :
if ( is_singular('post') ) {
$args = array(
'post_type' => 'attachment',
'posts_per_page' => -1,
'post_status' => null,
'parent' => $post->ID ,
'child_of' => $post->ID,
'sort_order' => 'desc'
);
$attachments = get_pages( $args );
if ( $attachments ) {
foreach ( $attachments as $attachment ) {
echo wp_get_attachment_url( $attachment->ID );
}
}else {
}
}
I hope this code help you
Related Posts:
- How to get URL of current page displayed?
- Encode text string being appended as query to URL [closed]
- Is it safe to use $_SERVER[‘REQUEST_URI’]?
- How to add a class to the attachment images
- The correct method to pass query vars in AJAX using ajaxurl
- How to check if feed URL was requested?
- What is the best practice for escaping data URIs?
- urlencoding of the_title() doesn’t work?
- How do I get the author’s page url from their ID?
- Dynamic URL to reference custom PHP files
- Add custom field to attachments in a specific category
- Conditional Statement – check if post has an attachment image
- Upload images and attachments from frontend form
- Use Timber/Twig to pull an image by image ID [closed]
- What’s the proper way to use wp_enqueue_script/style?
- Callback URL in WordPress
- File upload, uploads only file name
- Wrong links in WordPress?
- Newbie question: no index.php? in my plain wordpress permalink
- How is WordPress manipulating the posts like there are folders?
- page template for attachement page?
- is it possible to force wordpress to always save thumbnails as ‘jpg’ not ‘png’
- Link to the parent post in attachment page
- Remove query string specific key value
- Echo URL of large version of Featured Image
- Why does WordPress remove my variables in the URL?
- WordPress Search Results for Multiple Post Types
- Colon is Missing In My Website Url in WordPress
- How to change redirection route to a php page for making it only accessible by logged-in members?
- How to use $_GET function WordPress backend
- Send multiple attachments with wp_mail in PHP
- Extend PHP regex to cover “srcset” and “style” attributes
- My php header() function is not working [closed]
- Attach previously uploaded image to post – current code has unexpected results
- Create custom permalinks to show Custom Post Type’s relationship?
- wp_mail file attachment not being placed in upload folder?
- Search Query: how to construct a search string from two select elements?
- Get URL Parameters from referer
- Need help enqueueing webfonts
- Returning data instead of echoing/printing
- Get the URL of the page from which an ajax request has been launched within ajax callback
- How to check if the current page is at a specified path in the URL?
- Post’s ID pattern?
- I’m unable to call img path using single quotes in an array?
- Need to Modify a WordPress Shortcode with another wordpress shortcode
- change default RSS feed URL
- How do i add slugs to a URL, but still redirecting to the same page
- Can’t change website Title on wordpress
- Find out last 7 days of upload images, last week uploaded image from Gallery and display them in different pages
- Nginx WordPress and another Web app URL structure
- How to use title attributes in sidebar widget?
- Call featured image url
- Creating customized php files in theme folder
- Front end file upload returning wrong attachment url
- How do I include an external PHP file in a subdir WordPress install?
- How to add PHP pagination to wordpress
- Use an anchor link to open an iframe inside a WordPress page
- Adding custom url to readmore link using get_permalink()
- How to set base url for php widget
- Comment_author_url doing nothing
- Attaching images to posts manually (i.e. with custom code, without the use of an API)
- Modifying WP URL handing code?
- How to deal with a GET variable of ‘name’?
- How to load previous or next attachment with jquery ?
- WordPress permalink issue
- Add class to all img if they have a certain ACF field
- Workaround for og:image unsupported webp image type, Yoast SEO?
- How to define a rule in functions.php that ONLY disables the default wp functionality that undesirably changes ‘&’ to ‘#038;’?
- Unable to display multiple parameters from url by javascript through shortcodes
- Get nice name of category from slug (remove dashes of category)
- Unable to delete related media attachments with deleted post
- Add Link to PHP message
- Current WordPress Page Title as Search Parameter into A Tag
- Attach and retrive multiple pdf files to post or page
- Get WordPress username to customize url
- WordPress/NGINX not respecting the category URL for new posts
- How does one make a URL return dynamic JSON with custom Content Type?
- Get list of posts from attachment
- Require advice handling a URL redirect from a Third Party. URL Params need to populate and then forward to payment
- WordPress add_rewrite_rule
- Need to Echo A Url path to show on a wordpress page
- How do I generate formatted permalinks as specified in backend options?
- Previewing/Updating some Pages causes “The requested URL was rejected” Error
- changing static link to relative link
- Create a dynamic buddupress tab
- extract url from a hyperlinked string in PHP [closed]
- File path for attachments outside of wp-content/uploads
- Retrieve first image url from custom post with pagination
- Magento and WordPress URL integration [closed]
- Post Title Not showing up
- Passing multiple variables through url (php)
- How to remove parent section in an attachment URL in wordpress?
- Get current WordPress page then add #post ID to the end
- How to include support for all page types, calendar urls, archive, etc
- Remove /category/ from category (archive) page URLs (without using a plugin)
- WPMU – How to echo only one URL
- How can I change the URL via add_rewrite_rule()
- bloginfo url in javascript
- How to extract URLs from wordpress taxonomies
- Create a custom plugin with dynamic child pages listing database records