Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress – Remove Paragraph tag around Images w/o Captions, Replace with Divs Reply To: WordPress – Remove Paragraph tag around Images w/o Captions, Replace with Divs

#156483
G M
Participant

Hi Alen! Thanks for repsonding!

That article is actually where I got my original preg_replace function that I tried to tweak.

They suggest using this: '\1\2\3' as the replacement code.
I think that is called a ‘backreference’ in php but I’ve been reading all day and I still can’t quite wrap my head around the language.

I tried to shortcut it by just rewriting the original replace pattern to use divs instead of p tags, but its clearly not that simple.

I was hoping someone with preg_replace familiarity could suggest an edit or better explain what is going on than the articles I’m currently reading :-)