Add Additional Lead Profile Fields to Lead Records and Map Form Fields

Introduction

There are two ways to add lead fields to your Leads system, one is to use the UI interface of our free Inbound Pro plugin, while the other is to use hard-coded WordPress filters to intercept and programatically add lead fields.

The Easy Way

If you are running the all-in-one Inbound Pro plugin then adding mappable lead fields is easy.

Head into wp-admin->Inbound Now->Settings and look for our mappable lead field section. Here you can change the field labels, add new mappable field locations, and control the order they appear inside a lead profile:

Add and edit mappable lead fields
Add and edit mappable lead fields

 

The Programatic Way (The harder way)

This snippet illustrates how you can add in additional lead profile fields to the lead records page. Placing this code in your theme’s functions.php file will add the fictitious lead fields to your mappable lead fields.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
<?php
/**
* Add in custom lead fields to WordPress Leads Plugin
*
* This function adds additional fields to your lead profiles. Insert this code into functions.php of your theme
* Label: Name of the Field
* key: Meta key associated with data
* priority: Where you want the fields placed. See https://github.com/inboundnow/leads/blob/master/modules/wpl.m.userfields.php#L7 for current weights
* type: type of user area. 'text' or 'textarea'
*/
 
add_filter('wp_leads_add_lead_field', 'custom_add_more_lead_fields', 10, 1);
function custom_add_more_lead_fields($lead_fields) {
 
$new_fields = array(
array(
'label' => 'Upper Company',
'key' => 'wpleads_upper_company',
'priority' => 18,
'type' => 'text'
),
array(
'label' => 'Lead Source',
'key' => 'wpleads_lead_source',
'priority' => 19,
'type' => 'text'
),
array(
'label' => 'Description',
'key' => 'wpleads_description',
'priority' => 19,
'type' => 'textarea'
)
);
 
foreach ($new_fields as $key => $value) {
array_push($lead_fields, $new_fields[$key]);
}
 
return $lead_fields;
 
}

After you have added the additional lead profile fields you can map those new fields via the inbound form tool on the edit fields section under advanced options. This will automatically populate the new field in lead profile with the value filled out in the form.