Get ALT attribute from title post (code not work)

Well, changing get_post( $post_ID )->post_title to get_the_title($page->ID) won’t work, because the variable $page isn’t defined anywhere in your function… If you’ll take a look at add_attachment hook, then you’ll see that it takes only one parameter: $post_ID – (int) Attachment ID. So you don’t have the ID of post that it’s attached to. And to … Read more