I want to replace my custom gallery shortcode in my post content with the default Wordpress shortcode (in pre get posts). I will be doing this in only a certain instance where it will need to be formatted in the default gallery shortcode format (in order to work with exporting to Apple News).
How can I search through the content for my custom gallery shortcode:
And then replace it with the default one:
I can handle the changing it from one id to the several ids by just creating a custom function that will just grab the one id, fetch that post, grab the array of images within that post (I use ACF galleries), and then return the list of ids.
So I just need to know how to search through the content, find each showGallery shortcode, and then for each of those shortcodes grab the id, send it to my custom function, remove the old shortcode, and then replace it with the new one that would be returned by my function.
I found this which seems close, but still can't figure out fully how to remove the old one, etc.