Shortcodes in classic block?
-
Good day,
In the process of migrating to gutenberg editor and it looks like posts created prior to gutenberg are put into a “classic” block and wonder what would be recommended strategy to dealing with these. Right now it looks like the classic block does not parse any of the shortcodes; like [code] shortcode just shows literal "[code]".
First idea:
Ideally, I would love to be able to convert all of these classic blocks to native gutenberg blocks but I am not clear what the best way to do that would be. On top of my head, I'm thinking looping through all the old posts with parse_blocks() then if the blockname is null, having it run through some custom parser. But then this idea seems very clunky to me.Second idea:
Or perhaps in the backend, I can maintain the classic editor but in presentation, I can add logic like "if classic block, run it through this filter to process the shortcodes to render the presentation html"? (Hmm, is there a filter function that would render raw shortcodes?)Has anyone gone through this or have any other suggestions?
Thanks in advance!
The topic ‘Shortcodes in classic block?’ is closed to new replies.