How to remove WordPress lightbox gallery images border

This problem was posted in WordPress support forum 6 years ago and it is still relevant to this day. I may not be the only one facing this problem.

Since I encountered it and I should share solutions with other WordPress blogger out there.

A user with an ID of esmi comes up with a solution.

He suggested we edit the core file inside the folder  /wp-includes/ and look for media.php file.

Open that file with text editor and go to line 1091 (refer codes below):

#{$selector} img {
    border: 2px solid #cfcfcf;
}

From here you can change the border size or set it to 0.

#{$selector} img {
    border: 0 none;
}

Keep note the file will revert back to its default state after next WordPress core files updates.

So you have to go back and edit the file if you want to change the border value again.

If you don’t want to do that, there is another way to this without the hassle editing the file by forcing it in your theme stylesheet. Just add:

#gallery-1 img {
border: none !important;
}

Leave a Reply