Adding caption to all images inside an article

I’m not 100% sure if I understand your question 100%, but WordPress, by default, displays the caption if it’s filled on the image. Then it displays it just below the image once the image is inserted. Here is an example where I just filled it out on one image 👇

How to add embed image in comments?

You can do that by using the comment_text filter. It runs for each comment, so with some regex you can find all links in the comment and loop through them. You make one more check to make sure the link has an image extension (jpg, jpeg, png, etc). If it does, we can embed it … Read more

changing option for all posts

In the option table image_default_link_type is the key for that setting. So you can change its value with filtering. Please see below example. add_filter( ‘option_image_default_link_type’, function () { return ‘file’; }); With this, file will be selected by default when you insert media attachment.