Adding photos in blog

Hi there

When I am adding photos in a blog post, then no matter what I choose for the image to link to… even none, then in the advanced section when I choose edit photo in the post it has added a

attachment wp-att-655

in the Link Rel

which opens up the photo when clicked on and even in the same window as the website, which is kind of unfortunate.

When I delete the “attachment wp-att-655” then when one photo is clicked then I can view all photos as a gallery in a popup window, which is what I want.

It is just a drag having to open up all photos one by one and deleting the “attachment wp-att-655”.

Is there a way to add photos to the blog and not getting the “attachment wp-att-655” automatically?!

Thanks for your time!



After adding the image using “Add Media” the image will automatically be linked to it’s attachment page, so you must remove the link, that should work.

Best Regards,


It works fine removing it manually. Just wish I didn’t have to do it manually :wink:

How come it is not the same using add media on normal pages… There I can choose link to media and it automatically creates a gallery.

But not in blogs?!



Dear Michael,

Try to add the following function into the theme’s functions.php file.

function sydney_remove_rel_attr($content) {
    return preg_replace('/\s+"attachment wp-att-[0-9]"+/i', '', $content);
add_filter('the_content', 'sydney_remove_rel_attr');

I’d recommend you to pass it in the child theme mode. So that the changes won’t be overridden once the theme gets updated in the future.

Let me know how it works.


Dear Kharis

I am having the child theme as active, but I am not quite sure where to add the code.

Do I have to go directly into the functions.php file through the FTP access or do I add it through the Dashboard and in some plugin?!

Thanks for your time


Dear Michael,

Through Dashboard, you can go Appearance > Editor > select functions.php file. You’d better go to FTP. In case you make a mistake there, it will be easier to recover.