WordPress at Your Fingertips
function is not described

SimplePie_Item::get_id() public WP 2

Get the unique identifier for the item

This is usually used when writing code to check for new items in a feed.

Uses <atom:id>, <guid>, <dc:identifier> or the about attribute for RDF. If none of these are supplied (or $hash is true), creates an MD5 hash based on the permalink, title and content.

{} It's a method of the class: SimplePie_Item{}

No Hooks.

Return

String|null.

Usage

$SimplePie_Item = new SimplePie_Item();
$SimplePie_Item->get_id( $hash, $fn );
$hash(true|false)
Should we force using a hash instead of the supplied ID?
Default: false
$fn(string|false)
User-supplied function to generate an hash
Default: 'md5'

Changelog

Since 2 Introduced.
Since Beta 2

Code of SimplePie_Item::get_id() WP 5.8.2

public function get_id($hash = false, $fn = 'md5')
{
	if (!$hash)
	{
		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'id'))
		{
			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
		}
		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id'))
		{
			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
		}
		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid'))
		{
			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
		}
		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier'))
		{
			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
		}
		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'identifier'))
		{
			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
		}
		elseif (isset($this->data['attribs'][SIMPLEPIE_NAMESPACE_RDF]['about']))
		{
			return $this->sanitize($this->data['attribs'][SIMPLEPIE_NAMESPACE_RDF]['about'], SIMPLEPIE_CONSTRUCT_TEXT);
		}
	}
	if ($fn === false)
	{
		return null;
	}
	elseif (!is_callable($fn))
	{
		trigger_error('User-supplied function $fn must be callable', E_USER_WARNING);
		$fn = 'md5';
	}
	return call_user_func($fn,
	       $this->get_permalink().$this->get_title().$this->get_content());
}