---
title: Ajouter des champs personnalisés au plan de site des images
url: "https://www.seopress.org/fr/support/hooks/ajouter-des-champs-personnalises-au-plan-de-site-des-images/"
lang: fr-FR
updated: 2021-09-29
hook_name: seopress_sitemaps_single_img
required_version: 3.6.2
---

# Ajouter des champs personnalisés au plan de site des images

- **Hook name:** `seopress_sitemaps_single_img`
- **Required version:** 3.6.2

```php
add_filter('seopress_sitemaps_single_img','sp_sitemaps_single_img', 10, 2);
function sp_sitemaps_single_img($imgs, $post_id){
	//Example with Advanced Custom Fields plugin
	//Replace get_field('test_img',$post_id) with your own custom field name
	if (function_exists('get_field') && get_field('test_img', $post_id) !='') {
		$html = '<image:image>';
		$html .= "\n";
		$html .= '<image:loc>';
		$html .= '<![CDATA['.get_field('test_img', $post_id).']]>';
		$html .= '</image:loc>';
		$html .= "\n";
		$html .= '</image:image>';
		$html .= "\n";
		
		return $imgs.$html;
	} else {
		return $imgs;
	}
}
```

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



