There’s an easier way built into WP Super Cache. On the Advanced Tab, scroll down to Accepted Filenames & Rejected URIs and if your gallery shows in the page types to exclude, you can just check it and save the change. If it doesn’t show up there, in the box for “Add here strings (not a filename) that forces a page not to be cached.” you can put:
and see if that does the trick.
that is awesome, but the gallery pages links to the actual gallery pages. those do not have the word gallery in it, but other names. If I were to put something in there like nocache (text version) and then put nocache in that setting where strings can be put, would that page then not be cached? Or does it only work if you put the partial url of the page? Thank you!
I should have looked at your site first.
Are all those links to pages, or posts on your Gallery page? The key is to come up with an approach that will be easy to maintain going forward. If they are all pages, I think what I would do is go through and make them all child pages of the parent “gallery” page. That way, “/gallery” will be in the path, and you’ll be good to go with the suggestion above. You can use the Bulk Actions -> Edit function to set the parent of a whole bunch of pages at once, making the task less painful. You’ll just have to remember to make all future gallery pages child pages of gallery. You can try it with just one or two pages (links) to make sure it works.
If any of the links on your Gallery page are posts, I think it might be more complicated. The ones I checked were pages, so if there are just a few posts, you could convert them to pages.
So….. you know you rock, right?
Thank you. That did the trick!