[wp-trac] [WordPress Trac] #26812: Unable to get attachment information in post or page .
WordPress Trac
noreply at wordpress.org
Sat Jan 11 15:04:05 UTC 2014
#26812: Unable to get attachment information in post or page .
--------------------------+------------------------------
Reporter: phpgenie | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: 3.8
Severity: normal | Resolution:
Keywords: |
--------------------------+------------------------------
Description changed by ocean90:
Old description:
> Hello Sir
>
> I am explaining this issue step by step.
> 1. Create new post or page.
> 2. Upload few images and few videos.
> 3. Insert 1 image and 1 video.
> 4. Publish this post.
> 5. Edit this post and insert another video and image.
> 6. Update this post.
>
> Now on front end, index.php page I want to show attachment information
> associated with images, videos like title, description. I am using
> following code inside loop.
> <?php
>
> $mchilds =& get_children( array (
> 'post_parent' => get_the_ID(),
> 'post_type' => 'attachment',
> 'numberposts' => -1,
> 'post_status' => 'any',
> ));
>
> //print_r($mchilds);
> ?>
> Resulting array $mchilds contains info about only one attachment. I have
> inserted 2 images and 2 videos, but $mchilds array is containing info of
> first one only.
> When I checked the database and run this query in database "select * from
> wplr_posts where post_parent='111'" then I found that other 3 attachments
> have value "revision" for "post_type" column.
> If I changed value of "post_type" column manually to "attachment" then in
> front end I will get info about all attachments in $mchilds array.
>
> I have checked this with 2 themes present in wordpress, I requested my
> brother also to check this and he also informed me same.
>
> So, I have a request, Please consider this issue.
>
> Thanks for your time.
>
> Regards
> Nidhi
New description:
Hello Sir
I am explaining this issue step by step.
1. Create new post or page.
2. Upload few images and few videos.
3. Insert 1 image and 1 video.
4. Publish this post.
5. Edit this post and insert another video and image.
6. Update this post.
Now on front end, index.php page I want to show attachment information
associated with images, videos like title, description. I am using
following code inside loop.
{{{
<?php
$mchilds =& get_children( array (
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => 'any',
));
//print_r($mchilds);
?>
}}}
Resulting array $mchilds contains info about only one attachment. I have
inserted 2 images and 2 videos, but $mchilds array is containing info of
first one only.
When I checked the database and run this query in database "select * from
wplr_posts where post_parent='111'" then I found that other 3 attachments
have value "revision" for "post_type" column.
If I changed value of "post_type" column manually to "attachment" then in
front end I will get info about all attachments in $mchilds array.
I have checked this with 2 themes present in wordpress, I requested my
brother also to check this and he also informed me same.
So, I have a request, Please consider this issue.
Thanks for your time.
Regards
Nidhi
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/26812#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list