How To Re-Attach Media Files In WordPress

WordPress gives you an option to attach a media file to a specific post, so it could belong to that specific post. It also creates a sub-page in your post for the image. Unfortunately, there’s no built-in option to re-attach media files in WordPress, but we’re going to create one with the help of this tutorial.

Just add following code to your current theme’s functions.php file: