Pitfalls of WordPress Shortcodes and Visual Page Editors

March 10th, 2018

WordPress is a great blogging platform that can also handle many CMS functions. It can be extended with plugins, much the same way as modules are used to extend Drupal. 

WordPress Plugins

WordPress plugins are usually "freemium", and most WordPress sites will need to purchase at least a couple commercial plugins. WordPress plugins aren't subjected to quite the level of scrutiny that Drupal code is, but there are some really great plugins out there. Selecting ones that will work long-term requires some careful thought.

Shortcodes and Visual Page Builders

There are many plugins that insert non-HTML code or shortcodes, and that means that if you ever wanted to move to another platform you would need to strip that out or replace it with normal HTML. Shortcodes could be replaced programmatically after content migration, but the code generated by many of the WordPress visual page builders is a different story. For example, the popular Divi Builder plugin (by Elegant Themes) inserts code like this into the HTML source;

[/et_pb_text][/et_pb_column][/et_pb_row]
[et_pb_row admin_label="Row"][et_pb_column type="1_3"]
[et_pb_text admin_label="Text" background_layout="light" text_orientation="left" use_border_color="off" border_color="#ffffff" border_style="solid"]

If you have migrated a lot of WordPress posts or pages to a new CMS (let's say Drupal), it can mean a ton of work to clean up code like that, because achieving that with regular expressions can be tricky to impossible. What we do in those scenarios is build a view in Drupal which shows all nodes containing "et_", which is a string used in every one of those Elegant Themes Divi Builder codes. This provides us with an overview of the affected pages so that we can go through and fix them manually. 

I should mention that the Divi Builder is pretty cool and very easy to use. I love those features... but I don't love the way it inserts non-HTML code into the post/page. It ends up making it difficult to switch CMSes later. Ideally a CMS will only use standard HTML in its content, so that when the time comes you can simply export your content and migrate to whichever CMS you want. The WP All Export plugin is really great for that; it allows you to define filters so you can export specific categories of posts, or even posts created after certain dates. 

Conclusion

If you are at all concerned about being able to easily migrate from WordPress to another CMS at some point in the future, try to avoid shortcodes and any visual page builders that insert non-HTML code. It will save you or your developers a lot of work down the road!

Need help migrating from WordPress to Drupal?

0

Auteur