Skip to content

How to Add a Custom Donation Field

You can add extra donation fields with a little bit of custom code.

This is a code snippet that shows how you can add a field to collect someone’s National ID Number: https://library.wpcode.com/snippet/e5w6q02d/

You can use that code snippet and customize it to suit your needs:

  • Replace every instance of ‘national_id_number’ with ‘your_field’.
  • Replace every instance of ‘National ID Number’ with the label for your field.

How to add a code snippet

If you are new to PHP or WordPress development, we recommend using the WPCode plugin to insert snippets safely and easily into your website. Charitable currently has over 130 snippets in the WPCode plugin library you can use. Visit our library here:

https://library.wpcode.com/profile/wpcharitable/

For those a little more familiar with WordPress development, you can use the snippets to create simple standalone plugins. Read the WordPress documentation about creating a plugin.

Alternatively, you could add the snippets directly to your theme or child theme’s functions.php file.

Please be aware of our recommendations and suggestions for safe practices using code snippets to avoid fatal errors and issues. Read our guide here.

Problems?

If you run into any problems with this please feel to reach out to our support team.