|
/ Documentation /Developer Hooks & Events/ suredonation_output_campaign_meta_tags Filter Hook

suredonation_output_campaign_meta_tags Filter Hook

Overview

The suredonation_output_campaign_meta_tags filter controls whether SureDonation outputs Open Graph and Twitter Card meta tags for a campaign.

These meta tags are used by social platforms to generate previews when a campaign URL is shared.

Use this filter when your theme or another SEO plugin already generates social-preview meta tags, and you want to prevent duplicate tags from being added by SureDonation.

When to Use This Filter

Use this filter to:

  • Disable SureDonation’s social-preview meta tags.
  • Prevent duplicate Open Graph tags.
  • Prevent duplicate Twitter Card tags.
  • Disable the tags for a specific campaign.
  • Allow another SEO plugin or theme to manage social metadata.

Filter Signature

apply_filters(  'suredonation_output_campaign_meta_tags', true, $campaign_id );

Parameters

ParameterTypeDescription
$valueboolDetermines whether SureDonation should output the campaign meta tags.
$campaign_idintThe campaign post ID.

Default Value

The default value is: true

This means SureDonation outputs the campaign meta tags when all required conditions are met.

Return Value

Return a boolean value:

Return ValueResult
trueSureDonation outputs the campaign meta tags.
falseSureDonation does not output the campaign meta tags.

Basic Usage

Use add_filter() to register your callback.

add_filter( 'suredonation_output_campaign_meta_tags',  'your_custom_function', 10, 2);

function your_custom_function( $output, $campaign_id ) {

    return $output;

}

Example: Disable Meta Tags for a Specific Campaign

The following example disables SureDonation’s meta tags for campaign ID 12.

add_filter( 'suredonation_output_campaign_meta_tags',

    function ( $output, $campaign_id ) {

        // Disable SureDonation's OG tags for a specific campaign.

        return 12 === $campaign_id ? false : $output;

    },

    10,

    2

);

For all other campaigns, the original value is returned.

Example: Disable Meta Tags Globally

If your SEO plugin or theme already manages social metadata, you can disable SureDonation’s campaign meta tags globally.

add_filter( 'suredonation_output_campaign_meta_tags', '__return_false');

This prevents SureDonation from outputting its campaign Open Graph and Twitter Card meta tags.

How It Works

The filter is part of the campaign meta-tag generation process:

  1. SureDonation checks whether the current request is a valid campaign page.
  2. SureDonation checks whether the campaign is published and publicly accessible.
  3. SureDonation checks whether another SEO plugin or the theme is already generating Open Graph tags.
  4. SureDonation applies the suredonation_output_campaign_meta_tags filter.
  5. If the filter returns true, the campaign meta tags are output.
  6. If the filter returns false, the meta tags are not output.

Additional Conditions

The filter is only reached after SureDonation’s other campaign checks have passed.

The current request must be:

  • A singular campaign request.
  • For a published campaign.
  • Not password protected.

SureDonation also checks whether an SEO plugin or theme is already providing Open Graph metadata.

This filter is applied in: Campaign_Meta_Tags::print_meta_tags()

The filter was introduced in SureDonation 1.2.0.

If another SEO plugin or your theme already generates social-preview metadata, disabling this filter can help prevent duplicate Open Graph or Twitter Card tags.

Notes

This filter is applied in:

Campaign_Meta_Tags::print_meta_tags()

The filter was introduced in SureDonation 1.2.0.

If another SEO plugin or your theme already generates social-preview metadata, disabling this filter can help prevent duplicate Open Graph or Twitter Card tags.

Related Hooks

None.

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
Table of Contents
Scroll to Top