xmlsf_news_keywords

Filters the news keywords array in Google News Advanced. Passes the keywords array and $post_id; must return an array.

apply_filters( 'xmlsf_news_keywords', array[] $keywords, int[] $post_id )

Used in xml-sitemap-feed-advanced-news/inc/class-main.php

Parameters (2)

  • $keywords
    (array) The news keywords array.
  • $post_id
    (int) The current post ID.

Return

  • (array) The news keywords array.

The filter should return an array with keywords for the current post.

Usage example

function my_custom_keywords( $keywords, $post_id ) {
	$post_keywords = get_post_meta( $post_id, 'keyword' );

	return array_merge( (array) $keywords, $post_keywords );
}
add_filter( 'xmlsf_news_keywords', 'my_custom_keywords' );

Related

Used byDescription
none