Developer Documentation
Since version 1.1.0 of Impressum Plus there is are plenty possibilities to change the output of particular content.
General Filters
impressum_admin_default_tab
Through the filter impressum_admin_default_tab
the default active tab in the imprint settings in the backend can be set.
Parameters:
string $default_tab The default tab (default: imprint
)
Expects a string.
Example
function my_impressum_admin_default_tab( $default_tab ) {
return 'my-tab';
}
add_filter( 'impressum_admin_default_tab', 'my_impressum_admin_default_tab' );
Code language: PHP (php)
impressum_admin_tab
Through the filter impressum_admin_tab
you can change the tabs in the backend.
Parameters:
array $tabs The tabs in the backend
string $form_action The action of the form inside the tab
string $current_tab The current active tab
Expects an array.
Example
function my_impressum_admin_tab( $tabs, $form_action, $current_tab ) {
$slug = 'my-tab';
// get content
ob_start();
echo '<div class="nav-tab-content' . ( $current_tab === $slug ? ' nav-tab-content-active' : '' ) . '" id="nav-tab-content-' . esc_attr( $slug ) . '">';
echo '<form action="' . esc_html( $form_action ) . '" method="post">';
// output security fields for the registered setting "impressum"
settings_fields( 'impressum_' . $slug );
// output setting sections and their fields
// (sections are registered for "impressum", each field is registered to a specific section)
do_settings_sections( 'impressum_' . $slug );
// output save settings button
submit_button( __( 'Save Settings', 'impressum-plus' ) );
echo '</form>';
echo '</div>';
$tabs[] = [
'content' => ob_get_clean(),
'slug' => $slug,
'title' => __( 'My Tab', 'impressum-plus' ),
];
return $tabs;
}
add_filter( 'impressum_admin_tab', 'my_impressum_admin_tab', 10, 3 );
Code language: PHP (php)
impressum_api_api_args
Through the filter impressum_api_api_args
you can change the parameters of the particular fields in the API.
Parameters:
array $api_args The API parameters
Expects an array.
Example
function my_impressum_api_api_args( $api_args ) {
// get $settings_fields from somewhere with each field
// having a sub-index 'api' for API related information
foreach ( $settings_fields as $key => $settings_field ) {
if ( empty( $settings_field['api'] ) ) continue;
$my_args[ $key ] = $settings_field['api'];
}
return $my_args;
}
add_filter( 'impressum_api_api_args', 'my_impressum_api_api_args' );
Code language: PHP (php)
impressum_api_option_name
Through the filter impressum_api_option_name
you can change the name of the options, that should be returned/changed via API.
Parameters:
string $option_name The option’s name
\WP_REST_Request $request The current request object (since 2.3.0)
Expects a string.
Example
function my_impressum_api_option_name( $option_name, $request ) {
return 'my_option';
}
add_filter( 'impressum_api_option_name', 'my_impressum_api_option_name', 10, 2 );
Code language: PHP (php)
impressum_api_option_sub_key
since 2.3.0
Through the filter impressum_api_option_sub_key
you can change the name of the key of the option, that should be returned/changed via API.
Parameters:
string $sub_key The sub key name
\WP_REST_Request $request The current request object
Expects a string.
Example
function my_impressum_api_option_name( $sub_key, $request ) {
return 'name';
}
add_filter( 'impressum_api_option_sub_key', 'my_impressum_api_option_name', 10, 2 );
Code language: PHP (php)
impressum_api_tab_content
Through the filter impressum_api_tab_content
you can change the content of the tab “API” in the backend.
Parameters:
string $content The “API”’s tab content
Expects a string.
Example
function my_impressum_api_tab_content( $content ) {
// do stuff with content
// then
return $content;
}
add_filter( 'impressum_api_tab_content', 'my_impressum_api_tab_content' );
Code language: PHP (php)
impressum_country_after_sort
Through the filter impressum_country_after_sort
you can change the countries after they have been sort.
Parameters:
array $countries The top 50 countries alphabetically
Expects an array.
Example
function my_impressum_country_after_sort( $countries ) {
$countries['grl'] = __( 'Greenland', 'my-textdomain' );
return $countries;
}
add_filter( 'impressum_country_after_sort', 'my_impressum_country_after_sort' );
Code language: PHP (php)
impressum_country_pre_sort
Through the filter impressum_country_pre_sort
you can change the countries before they have been sort.
Parameters:
array $countries The top 50 countries
Expects an array.
Example
function my_impressum_country_pre_sort( $countries ) {
$countries['grl'] = __( 'Greenland', 'my-textdomain' );
return $countries;
}
add_filter( 'impressum_country_pre_sort', 'my_impressum_country_pre_sort' );
Code language: PHP (php)
impressum_disabled_backend
impressum_disabled_backend
Through the filter impressum_disabled_backend
you can define whether the backend should be displayed or not (can be useful if controlled via API).
Parameters:
bool $disabled_backend true
, if the backend should not be displayed, false
otherwise (default: false
)
Expects a boolean.
Example
add_filter( 'impressum_disabled_backend', '__return_true' );
Code language: PHP (php)
impressum_disabled_notice
Through the filter impressum_disabled_notice
you can define whether the notice in the backend should be displayed, that informs you about an incomplete imprint.
Parameters:
bool $disabled_notice true
, if the notice should be disabled false
otherwise (default: false
)
Expects a boolean.
Example
add_filter( 'impressum_disabled_notice', '__return_true' );
Code language: PHP (php)
impressum_imprint_tab_content
Through the filter impressum_imprint_tab_content
you can change the content of the tab “imprint” in the backend.
Parameters:
string $content The “imprint”’s tab content
Expects a string.
Example
function my_impressum_imprint_tab_content( $content ) {
// do stuff with content
// then
return $content;
}
add_filter( 'impressum_imprint_tab_content', 'my_impressum_imprint_tab_content' );
Code language: PHP (php)
impressum_legal_entity_after_sort
Through the filter impressum_legal_entity_after_sort
you can change the legal entities after they have been sort.
Parameters:
array $legal_entities The legal entities alphabetically
Expects an array.
Example
function my_impressum_legal_entity_after_sort( $legal_entities ) {
$legal_entities['other'] = __( 'Other', 'my-textdomain' );
return $legal_entities;
}
add_filter( 'impressum_legal_entity_after_sort', 'my_impressum_legal_entity_after_sort' );
Code language: PHP (php)
impressum_legal_entity_pre_sort
Through the filter impressum_legal_entity_pre_sort
you can change the legal entities before they have been sort.
Parameters:
array $legal_entities The legal entities
Expects an array.
Example
function my_impressum_legal_entity_pre_sort( $legal_entities ) {
$legal_entities['other'] = __( 'Other', 'my-textdomain' );
return $legal_entities;
}
add_filter( 'impressum_legal_entity_pre_sort', 'my_impressum_legal_entity_pre_sort' );
Code language: PHP (php)
impressum_privacy_settings_fields
impressum_privacy_settings_fields
Through the filter impressum_privacy_settings_fields
you can change the settings fields of tab “Privacy” in the backend.
Parameters:
array $settings_fields The current privacy settings fields
Expects an array.
Example
function my_impressum_privacy_settings_fields( $settings_fields ) {
// add a custom settings field
$settings_fields['my_field'] = [
'title' => __( 'My Field', 'my-textdomain' ),
'callback' => 'text_callback', // function name or function
'page' => 'impressum_privacy',
'section' => 'impressum_section_privacy_general',
'args' => [
'label_for' => 'my_field',
'class' => 'impressum_row',
'description' => __( 'Optional description for my field', 'my-textdomain' ),
],
'api' => [
'description' => esc_html__( 'The checkbox whether my field is being used.', 'my-textdomain' ),
'type' => 'text',
],
];
return $settings_fields;
}
add_filter( 'impressum_privacy_settings_fields', 'my_impressum_privacy_settings_fields' );
Code language: PHP (php)
impressum_privacy_tab_content
Through the filter impressum_privacy_tab_content
you can change the content of the tab “Privacy” in the backend.
Parameters:
string $content string $content The “Privacy”’s tab content
Expects a string.
Example
function my_impressum_privacy_tab_content( $content ) {
// do stuff with content
// then
return $content;
}
add_filter( 'impressum_privacy_tab_content', 'my_impressum_privacy_tab_content' );
Code language: PHP (php)
impressum_settings_fields
Through the filter impressum_settings_fields
you can change the settings fields in the backend.
Parameters:
array $settings_fields The current settings fields
Expects an array.
Example
function my_impressum_settings_fields( $settings_fields ) {
// add a custom settings field
$settings_fields['my_field'] = [
'title' => __( 'My Field', 'my-textdomain' ),
'callback' => 'impressum_input_text_callback', // function name or function
'page' => 'impressum_imprint',
'section' => 'impressum_section_imprint',
'args' => [
'label_for' => 'my_field',
'class' => 'impressum_row',
'description' => __( 'Optional description for my field', 'my-textdomain' ),
'required' => true,
],
'api' => [
'description' => esc_html__( 'The checkbox whether my field is being used.', 'my-textdomain' ),
'type' => 'text',
],
];
return $settings_fields;
}
add_filter( 'impressum_settings_fields', 'my_impressum_settings_fields' );
Code language: PHP (php)
Filter Privacy Policy
The following filters are ordered by their appearance.
impressum_privacy_has_content
deprecated 2.11.0
Through the filter impressum_privacy_has_content
you can override the check if a policy has content.
Deprecated since 2.11.0, use impressum_privacy_is_active_policy
instead.
Parameters:
string $option_name The option name to test
Expects a boolean.
impressum_privacy_is_active_policy
since 2.11.0
Through the filter impressum_privacy_is_active_policy
you can override the check if a policy has content.
Parameters:
string $option_name The option name to test
mixed[] $options Current privacy options
Expects a boolean.
impressum_privacy_policy_content_{$category}
since 2.11.0
Through the filter impressum_privacy_policy_content_{$category}
you can filter the policy content of a single category.
Parameters:
string $policies Current category’s policies
int $headline_number Current headline number
Expects a string.
impressum_privacy_${this}_content
Through the filter impressum_privacy_${this}_content
the content of the current area in the privacy policy can be changed.
Since 2.11.0, passing an array containing the content
and headline_number
is deprecated.
Parameters:
string $policy_general The current content of the privacy policy
int $headline_number Current headline number in the whole privacy policy
Expects a string.
Example
function my_impressum_privacy_general_content( $content ) {
// do stuff with content
// then
return $content;
}
add_filter( 'impressum_privacy_general_content', 'my_impressum_privacy_general_content' );
Code language: PHP (php)
impressum_privacy_general_content
See impressum_privacy_${this}_content
.
impressum_privacy_required_content
See impressum_privacy_${this}_content
.
impressum_privacy_ssl_content
See impressum_privacy_${this}_content
.
impressum_privacy_responsible_content
See impressum_privacy_${this}_content
.
impressum_privacy_definition_content
See impressum_privacy_${this}_content
.
impressum_privacy_legal_basis_content
See impressum_privacy_${this}_content
.
impressum_privacy_dpf_content
since 2.7.0
See impressum_privacy_${this}_content
.
impressum_privacy_logfile_content
See impressum_privacy_${this}_content
.
impressum_privacy_cookie_content
See impressum_privacy_${this}_content
.
impressum_privacy_consent_manager_content
See impressum_privacy_${this}_content
.
impressum_privacy_tracking_content
See impressum_privacy_${this}_content
.
impressum_privacy_gtm_content
See impressum_privacy_${this}_content
.
impressum_privacy_ads_content
See impressum_privacy_${this}_content
.
impressum_privacy_google_maps_content
See impressum_privacy_${this}_content
.
impressum_privacy_google_fonts_content
See impressum_privacy_${this}_content
.
impressum_privacy_youtube_content
See impressum_privacy_${this}_content
.
impressum_privacy_vimeo_content
See impressum_privacy_${this}_content
.
impressum_privacy_facebook_pixel_content
See impressum_privacy_${this}_content
.
impressum_privacy_additional_tracking_content
See impressum_privacy_${this}_content
.
impressum_privacy_contact_content
See impressum_privacy_${this}_content
.
impressum_privacy_comment_content
See impressum_privacy_${this}_content
.
impressum_privacy_cleantalk_content
since 2.7.0
See impressum_privacy_${this}_content
.
impressum_privacy_social_sharing_content
See impressum_privacy_${this}_content
.
impressum_privacy_register_content
See impressum_privacy_${this}_content
.
impressum_privacy_newsletter_content
See impressum_privacy_${this}_content
.
impressum_privacy_embed_privacy_content
See impressum_privacy_${this}_content
.
impressum_privacy_spotify_content
since 2.7.0
See impressum_privacy_${this}_content
.
impressum_privacy_storage_time_content
See impressum_privacy_${this}_content
.
impressum_privacy_rights_content
See impressum_privacy_${this}_content
.
impressum_privacy_paypal_content
See impressum_privacy_${this}_content
.
impressum_privacy_stripe_content
See impressum_privacy_${this}_content
.
impressum_privacy_mollie_content
See impressum_privacy_${this}_content
.
impressum_privacy_dhl_content
See impressum_privacy_${this}_content
.
impressum_privacy_jobs_content
See impressum_privacy_${this}_content
.
impressum_privacy_amazon_partner_content
See impressum_privacy_${this}_content
.
impressum_privacy_policy_content
Through the filter impressum_privacy_policy_content
the content of the complete privacy policy can be changed.
Parameters:
string $policy_content The privacy policy
Expects a string.
Example
function my_impressum_privacy_policy_content( $content ) {
// do stuff with content
// then
return $content;
}
add_filter( 'impressum_privacy_policy_content', 'my_impressum_privacy_policy_content' );
Code language: PHP (php)
Privacy Policy System Check Filters
Impressum Plus tries to detect certain content on the website within the System Check automatically and shows or hides according content in the privacy policy automatically.
After changing one or multiple of the filters below, you can force a re-check by saving the privacy settings in the backend.
impressum_privacy_{$option}_slugs
Through the filter impressum_privacy_{$option}_slugs
you can change the content of the plugins to be checked in the system check for the current option.
Parameters:
string[] $slugs The default given slugs
string $option The option name of the check
Expects an array.
Example
function my_impressum_privacy_contact_form_slugs( $slugs ) {
// add slug
$slugs[] = 'my-plugin/my-plugin.php';
// then
return $slugs;
}
add_filter( 'impressum_privacy_contact_form_slugs', 'my_impressum_privacy_contact_form_slugs' );
Code language: PHP (php)
impressum_privacy_contact_form_slugs
See impressum_privacy_${option}_slugs
.
impressum_privacy_google_ads_slugs
See impressum_privacy_${option}_slugs
.
impressum_privacy_shop_slugs
See impressum_privacy_${option}_slugs
.
impressum_privacy_comment_subscription_slugs
Table of Contents
- General Filters
- impressum_admin_default_tab
- impressum_admin_tab
- impressum_api_api_args
- impressum_api_option_name
- impressum_api_option_sub_key
- impressum_api_tab_content
- impressum_country_after_sort
- impressum_country_pre_sort
- impressum_disabled_backend
- impressum_disabled_notice
- impressum_imprint_tab_content
- impressum_legal_entity_after_sort
- impressum_legal_entity_pre_sort
- impressum_privacy_settings_fields
- impressum_privacy_tab_content
- impressum_settings_fields
- Privacy Policy Filters
- Privacy Policy System Check Filters