The thoughts about WordPress Forms

WordPress Forms

After a lot of time trying to work with all of WordPress plugins with forms I always think what this solution is not good at all. All of this form plugins for WordPress have many issues.

Hard to customize (integrate with theme)

I think this is most common rub with all of this plugins. Because all of them allow to create forms via interface and this idea is really great but only at words.

If you are creating a real-world form for your website you always want to add or fix “one more thing” which is very frequently not supported and can’t be resolved easily with interface on wp-admin pages. For example, you need more divs or other HTML tag wrappers, special logic for generating the class, id or other HTML attributes. Or even recreate forms (parts of them) dynamically.

After trying to complete your work you understand that you need to go deeper, make research and learn the source code. Unfortunately, each WordPress plugin has absolutely unique structure and logic organization (I’m also can name it this as file folders structure). This means that you need a lot of experience and knowledge about WordPress and plugins to solve your requirements.

Here are a many more aspects of this.

Slow performance

Each WordCamp have at least one hosting sponsor. This is cute 🙂 I suppose this happens because all of us searching for best hosting in the world and this market grows. Sites need more power and resources. But just increasing your memory_limit or size of the cache is not a good idea. Yes, servers created for work and loading. But you can’t get more and more resources from server to infinity (yeah, real world, sick).

For small sites almost all plugins are ok. But if you are wondering about milliseconds for page rendering then this is not ok. And we also can add hundreds or thousands views to kill servers.

Unpredictable (roles management)

Related to many other plugins — you can’t be absolutely sure about what this plugin do (right now or at all). If your site contains secure information which should never show to public – you need to check out the plugin code to trust it.

WordPress.org have the great set of rules about privacy policy but it refers only about which information which can’t be sent to external services (servers). Right now we are talking about local privacy — which data showed to the users, which data users can edit and more. For example one of popular plugins for SEO implements bulk editor for almost all users (roles) on the site.

It is not very critical but you need double check all the things with the plugin (and maybe review the code if your project is very important).

Messy code

This concern follows from the above sections. Somites it hard to understand documentation and the logic inside the plugin. And I do not see the plugins with native named methods for creating elements like this way:

// This is my view of how to create forms in perfect way
$form = Forms::createForm();
$input = Forms::createInput()
  ->addClass('custom-css-class')
  ->addId(new MyCustomIdIterator());
  //...
$form->add($input);

What I’m looking for?

In addition to all above thoughts will great see the following things.

  1. Well written code. Abstracted and reusable (for many projects, sites in Multisite with multi languages,..)
  2. The possibility to create forms via UI and programmatically by creating instances of PHP Classes. Or even create the form by writing PHP class and then edit it via UI.
  3. Best performance. Don’t store any form related configuration parts inside DB. Use PHP files instead of it.
    1. Dump foms to php files (classes).
  4. Maybe using twig for forms templates?
  5. Test for code inside. Will be highly appreciated.
  6. Compatibility with Composer installs.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s