How to add Custom Shortcode on Contact Form 7

A Brief Introduction to Contact Form 7 Contact Form 7 is one of the most popular and extensible plugin that exists as free plugin in WordPress Plugin Repository. At the point of writing it’s been downloaded 21 Million times and have an average rating of 4.4. Isn’t that amazing? Contact Form 7 was one of […]

Table of Content

A Brief Introduction to Contact Form 7

Contact Form 7 is one of the most popular and extensible plugin that exists as free plugin in WordPress Plugin Repository. At the point of writing it’s been downloaded 21 Million times and have an average rating of 4.4. Isn’t that amazing?

Contact Form 7 was one of my beloved plugin as WordPress Developer for years, as it was easy to use and provide me lot of flexibility in styling the form.

Contact Form by default comes with lot of salient features as:

  1. Easy to implement form
  2. Top Notch Validations
  3. Easy to add attachments
  4. CAPTCHA
  5. Akismet spam filtering etc

In most cases default forms works fine.

But this is blog is based on my experience on extensibility of the plugin to add a new feature during some custom wordpress development. Adding custom feature in Custom Form 7 is relatively easy, as it’s been well built within coding standards and well maintained and updated.

So How to add a custom shortcode?

I am sharing a snippets that adds the custom shortcode my_custom_shortcode , hereby:

<?php

//create a shortcode my_custom_shortcode
wpcf7_add_shortcode('my_custom_shortcode', 'my_custom_shortcode_function', true);

function my_custom_shortcode_function(){
	// do my things here
}

?>

Hope it helps.

 

About Author

Robin Thebe

Digital Strategist based in Sydney.

I am multi disciplined web developer based in Sydney focusing around WordPress web design, wordpress development, SEO Services, SEM and Email Marketing.