WPSEO_Taxonomy::get_tag_id()private staticYoast 1.0

Get the current tag ID from the GET parameters.

Метод класса: WPSEO_Taxonomy{}

Хуков нет.

Возвращает

int|null. the tag ID if it exists, null otherwise.

Использование

$result = WPSEO_Taxonomy::get_tag_id();

Код WPSEO_Taxonomy::get_tag_id() Yoast 23.4

private static function get_tag_id() {
	// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
	if ( isset( $_GET['tag_ID'] ) && is_string( $_GET['tag_ID'] ) ) {
		// phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information, We are casting to an integer.
		$tag_id = (int) wp_unslash( $_GET['tag_ID'] );
		if ( $tag_id > 0 ) {
			return $tag_id;
		}
	}
	return null;
}