Keep up to date with Gravity PDF

  • This field is for validation purposes and should be left unchanged.
Jump To Section

Description #description

This filter can be used to add new fields to the Tools tab of the Gravity PDF settings page. It’s basically a Fields API and all validation, sanitising and saving is handled automatically for you.

The Tools tab doesn’t have a submit button like other pages. This page is specifically for action tasks like Setup Custom Templates. If you want to add a new action you should include a new form button and do your processing from the gfpdf_tool_tab_actions action.

Parameters #parameters

$fields | array
An associative array that includes a breakdown of the field information. We go into more detail about what each field configuration setting does in our custom PDF configuration guide.

Usage #usage

The following snippet shows you how to add a new button to the Tools tab. Remember, when adding new buttons you also need to do your processing in the gfpdf_tool_tab_actions action.

add_filter( 'gfpdf_settings_tools', function( $fields ) {

    * Ensure you prefix the array key and ID to prevent any conflicts

    /* Add a colour picker to the Security section of the General Settings page */
    $fields['prefix_flush_logs'] = array(
        'id'   => 'prefix_flush_logs',
        'name' => __('Flush Logs', 'prefix-text-domain' ),
        'type' => 'button',
        'desc' => __('Deletes all existing Gravity PDF log files', 'prefix-text-domain' ),
        'std'     => __( 'Purge', 'prefix-text-domain' ),

    return $fields;
} );

The following snippet shows you how to change the label of an existing field:

add_filter( 'gfpdf_settings_tools', function( $fields ) {

    if ( isset( $fields['setup_templates'] ) ) {
        $fields['setup_templates']['name'] = __( 'Install Custom Templates', 'prefix-text-domain' );

    return $fields;
} );

Source Code #source-code

This filter is located in the Helper_Options_Fields::get_registered_fields() method of /src/helper/Helper_Options_Fields.php.

Signup for the latest Gravity PDF news, tips and updates

  • This field is for validation purposes and should be left unchanged.
Scroll To Top

Choose your currency:

Converted prices are for reference only - all orders are charged in $ Australian Dollars ($) AUD.
  • AUDAustralian Dollars ($)
  • USDUS Dollars ($)
  • CADCanadian Dollars ($)
  • EUREuros (€)
  • GBPPound Sterling (£)
  • NZDNew Zealand Dollar ($)
  • JPYJapanese Yen (¥)