How to Change Placeholders for Different Services on Your Website

If you’re using Complianz on your website, you might want to change the default placeholder images for different services like YouTube, Google Maps, or Instagram. This guide will show you how to do that easily, without manually updating any folders. We’ll also walk you through using either code or (S)FTP, so you can choose the option that works best for you.

How to Change Placeholders for Different Services

You can change the placeholder image for different services, like YouTube, Google Maps, and Facebook. Here’s how:

Step 1: Add This Code to Your Website

First, you will need to add some code to your website’s functions.php file. This file controls many features of your website.

<?php
/* 
** Remove line 1 when you're NOT using a MU plugin
** Service-name custom placeholder will replace all Service-name placeholders
*/ 
 
// Function to set a custom placeholder 
function cmplz_my_custom_default_placeholder($new_src, $src){
 $new_src = 'https://yourdomain.com/my-custom-placeholder.jpg';
 return $new_src;
 }
// Apply the custom placeholder to the supported service by changing the filter name 
 add_filter( 'cmplz_placeholder_default', 'cmplz_my_custom_default_placeholder', 10, 2 ); // (YouTube default)

See the supported services below for the ones you can customize placeholders for.

Step 2: Replace the URL

Use the code above and replace the part that says 'https://yourdomain.com/my-custom-placeholder.jpg' with the URL of your own custom placeholder image.

Step 3: Upload the Code

Once you’ve made the changes, save the file and add the code to your theme’s functions.php file or a custom plugin. The new custom placeholder will now appear for the service listed.

Customize Placeholders for Different Services

You can also set different placeholders for specific services. Simply follow the same method for other services, like Google Maps, Facebook, or Instagram, by changing the filter name at the end (cmplz_placeholder_facebook, cmplz_placeholder_google-maps, etc.).

Supported Services

Here’s a list of all the services you can change the placeholder for:

  • YouTube (default): Use cmplz_placeholder_default
  • Google Maps: Use cmplz_placeholder_google-maps
  • Facebook: Use cmplz_placeholder_facebook
  • Instagram: Use cmplz_placeholder_instagram
  • Google reCAPTCHA: Use cmplz_placeholder_google-recaptcha
  • Twitter: Use cmplz_placeholder_twitter
  • SoundCloud: Use cmplz_placeholder_soundcloud
  • Spotify: Use cmplz_placeholder_spotify
  • TED: Use cmplz_placeholder_ted
  • OpenStreetMap: Use cmplz_placeholder_open-street-maps
  • Calendly: Use cmplz_placeholder_calendly
 

This method is simple, so you won’t need to manually replace images in folders. Just add the code to your functions.php file, and you’re all set!

Alternative Steps – Adding Your Own Placeholder via (S)FTP

To customize the default placeholder image, you’ll need access to your server—either via (S)FTP, your hosting panel’s File Manager, or a File Manager plugin.

Here’s how to do it:

Step 1: Create the placeholder folder in your theme

We’ve added a filter that allows you to override the default placeholder by adding a specific folder to your theme directory. The folder name depends on your Complianz version:

  • Free: complianz-gdpr
  • Premium: complianz-gdpr-premium
  • Premium Multisite: complianz-gdpr-premium-multisite
 

The structure should look like this:

/wp-content/themes/your-theme-folder/complianz-gdpr/  
/wp-content/themes/your-theme-folder/complianz-gdpr-premium/  
/wp-content/themes/your-theme-folder/complianz-gdpr-premium-multisite/

Step 2: Add your custom placeholder image

Inside the folder you just created, upload your custom placeholder image. To correctly override the default image, your file must have the same name as the original.

To find the current placeholder image name:

  • Open your site in a browser.
  • Use the developer tools (right-click > Inspect).
  • Use the element selector to find the placeholder block.
  • Look for the data-placeholder-image attribute, which will show the current image URL, e.g.:
data-placeholder-image="https://your-domain/wp-content/plugins/complianz-gdpr-premium/assets/images/placeholders/default-minimal.jpg"

In this example, to override default-minimal.jpg, upload your custom image with that exact name (in .jpg format) to:

/wp-content/themes/your-theme-folder/complianz-gdpr/default-minimal.jpg

Step 3: Verify the result

Once uploaded, check your site to confirm that the placeholder has updated as expected.

If you have any questions or need more help, feel free to ask our support!

Join 1M+ users and install The Privacy Suite for WordPress locally, automated or fully customized, and access our awesome support if you need any help!

Complianz has received its Google CMP Certification to conform to requirements for publishers using Google advertising products.