function taxonomy_term_load

Same name in other branches
  1. 7.x modules/taxonomy/taxonomy.module \taxonomy_term_load()

Return the taxonomy term entity matching a term ID.

Parameters

$tid: A term's ID

Return value

\Drupal\taxonomy\Entity\Term|null A taxonomy term entity, or NULL if the term was not found. Results are statically cached.

Deprecated

in drupal:8.0.0 and is removed from drupal:9.0.0. Use Drupal\taxonomy\Entity\Term::load().

See also

https://www.drupal.org/node/2266845

1 call to taxonomy_term_load()
TaxonomyLegacyTest::testEntityLegacyCode in core/modules/taxonomy/tests/src/Kernel/TaxonomyLegacyTest.php
@expectedDeprecation taxonomy_term_load_multiple() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\taxonomy\Entity\Term::loadMultiple(). See https://www.drupal.org/node/2266845 @expectedDeprecation…

File

core/modules/taxonomy/taxonomy.module, line 456

Code

function taxonomy_term_load($tid) {
    @trigger_error('taxonomy_term_load() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \\Drupal\\taxonomy\\Entity\\Term::load(). See https://www.drupal.org/node/2266845', E_USER_DEPRECATED);
    if (!is_numeric($tid)) {
        return NULL;
    }
    return Term::load($tid);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.