get_image_tag filter. Can you extract the id of the post in here?
-
Is there any way to get the id of the post to which the image is being attached? It doesn’t seem like there would be, but I wanted to check in here to make sure. The post variable always returns the attachments post variables.
add_filter( 'get_image_tag', 'edit_image_tag', 10 , 4 ); function edit_image_tag( $html, $id, $alt, $title ) { /** This is the post id of the post, not the attachment? So i can use it to grab title, meta values, etc. **/ echo $current_post->ID; }
Has anyone been able to make this work?
- The topic ‘get_image_tag filter. Can you extract the id of the post in here?’ is closed to new replies.