Hi all,
if a have this url:
domain.com/?attachment_id=198
¿can I get the post id of this attachment in atattchment.php or image.php?
Thanks!
Hi all,
if a have this url:
domain.com/?attachment_id=198
¿can I get the post id of this attachment in atattchment.php or image.php?
Thanks!
$postid = get_the_ID();
Thanks otto42,
I put that code and i got attachment ID not post ID, let me explain:
I wrote a post and i uploaded 10 pictures
The post ID:
?p=10
and attachment id:
?attachment_id=1,
?attachment_id=2,
?attachment_id=3,....?attachment_id=10,
If i put in browser domain.com?attachment_id=4,¿ how can i get post_id ?(in this case p=10)
pd: my english sucks, sorry :(
I found the solution
$post->post_parent;
This topic has been closed to new replies.