Using WordPress ’embed_site_title_html’ PHP filter

The embed_site_title_html WordPress PHP filter allows you to modify the site title HTML in the embed footer.

Usage

add_filter('embed_site_title_html', 'your_custom_function_name', 10, 1);

function your_custom_function_name($site_title) {
    // your custom code here
    return $site_title;
}

Parameters

  • $site_title (string) – The site title HTML to be filtered.

More information

See WordPress Developer Resources: embed_site_title_html

Examples

Change site title font size

To change the font size of the site title in the embed footer:

function change_embed_title_font_size($site_title) {
    $site_title = '<span style="font-size:24px;">' . $site_title . '</span>';
    return $site_title;
}
add_filter('embed_site_title_html', 'change_embed_title_font_size');

Add a custom CSS class

To add a custom CSS class to the site title in the embed footer:

function add_custom_css_class($site_title) {
    $site_title = '<span class="custom-title-class">' . $site_title . '</span>';
    return $site_title;
}
add_filter('embed_site_title_html', 'add_custom_css_class');

Add an icon before the site title

To add an icon before the site title in the embed footer:

function add_icon_before_title($site_title) {
    $site_title = '<i class="fas fa-globe"></i> ' . $site_title;
    return $site_title;
}
add_filter('embed_site_title_html', 'add_icon_before_title');

To wrap the site title in a link in the embed footer:

function wrap_title_in_link($site_title) {
    $site_url = home_url();
    $site_title = '<a href="' . $site_url . '">' . $site_title . '</a>';
    return $site_title;
}
add_filter('embed_site_title_html', 'wrap_title_in_link');

Change site title color

To change the site title color in the embed footer:

function change_title_color($site_title) {
    $site_title = '<span style="color:#FF5733;">' . $site_title . '</span>';
    return $site_title;
}
add_filter('embed_site_title_html', 'change_title_color');