---
title: Filter the HTML of the Google Preferred Sources button
url: "https://www.seopress.org/support/hooks/filter-the-html-of-the-google-preferred-sources-button/"
lang: en-US
updated: 2026-06-16
hook_name: seopress_preferred_source_html
required_version: 10.0
---

# Filter the HTML of the Google Preferred Sources button

- **Hook name:** `seopress_preferred_source_html`
- **Required version:** 10.0

```php
add_filter( 'seopress_preferred_source_html', 'sp_preferred_source_html', 10, 4 );
function sp_preferred_source_html( $button, $args, $domain, $url ) {
	// Wrap the button in a custom container.
	return '<div class="my-preferred-source">' . $button . '</div>';
};
```

Source: [https://gist.github.com/wp-seopress/1c07bf86b02fe645a8a30e02dde455b8](https://gist.github.com/wp-seopress/1c07bf86b02fe645a8a30e02dde455b8)



