PHP has historically been the de facto way to build forms with WordPress. Any plugin relying on WordPress functions is going to use PHP and this is neither good or bad, it’s a part of the WordPress ecosystem. This can present a few issues when migrating to a different hosting environment that doesn’t support PHP.

Shifter provides a way for users to generate static sites from their WordPress installations and host them in a purely CDN environment. This compared to a LAMP or LEMP server, which requires no scaling or security maintenance, also offers a significant difference in cost.

This CDN first approach to hosting, like most static site generators, offers greater scalability and security for your sites. However, it does leave behind dynamic PHP functions your WordPress sites and Plugins once relied on.

Despite losing those functions during this process we do have a few options to bring them back.

Our first option would be to use Javascript alternatives. For example, if you display the local time using the PHP Date function you could easily replace that with the JavaScript Date alternative. The JavaScript function will work in both environments.

Our second option would be to use the existing WordPress plugins and shim them with JavaScript solutions. By using PHP and JavaScript together you can selectively target and replace the features of a plugin that do not work in a CDN environment.

For example, the problem we faced was getting existing WordPress Forms Plugins to work on Shifter. In a CDN environment, the PHP and AJAX for something like Contact Form 7 were no longer there. By identifying the few pieces of code we needed to change, we extended the functionality of the CF7 plugin with no changes to the plugin itself.

Using this idea we created WP Serverless Forms. A WordPress Plugin to extend the functionality of existing forms plugins to work on static hosting environments like Shifter.

It works by replacing the form actions once handled by WordPress with an action you can customize. When a user submits your form you can send that data to any 3rd party service such as IFTTT, FormKeep, a custom WebHook and more.

This is also our first official plugin release for Shifter! For our initial release, we are supporting Contact Form 7 and have a roadmap for other contact form plugins like Gravity Forms, Ninja Forms and more.

WP Serverless Forms is available now in the WordPress Plugins Directory and Github.

Did this answer your question?