Notice: There is no legacy documentation available for this item, so you are seeing the current documentation.
This filter can be used to filter the entries that are included in the RSS sitemap/feed.
Parameters (1)
$entries (array)
The sitemap entries.
Example code snippet
The code snippet below can be used to change the time zone offset in the publish date of the sitemap entries. This can be useful for when a platform requires the date to be formatted to a specific timezone (e.g. Yandex News/Zen/Дзéн).
add_filter( 'aioseo_sitemap_rss', 'aioseo_filter_rss_sitemap_entries' );
function aioseo_filter_rss_sitemap_entries( $entries ) {
$entries = array_map( function ( $entry ) {
if ( empty( $entry['pubDate'] ) ) {
return $entry;
}
$dateTime = new DateTime();
$dateTime->setTimestamp( strtotime( $entry['pubDate'] ) );
$dateTime->setTimezone( new DateTimeZone( 'Europe/Moscow' ) );
$entry['pubDate'] = date_format( $dateTime, 'D, d M Y H:i:s O' );
return $entry;
}, $entries );
return $entries;
}
Changelog
Version | Description |
---|---|
4.0.0 | Introduced. |