• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress core a2z

WordPress core a2z

WordPress core only

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / wp_update_term_count_now() – Perform term count update immediately.

You appear to be a bot. Output may be restricted

Description

Perform term count update immediately.

Usage

$true = wp_update_term_count_now( $terms, $taxonomy );

Parameters

$terms
( array ) required – The term_taxonomy_id of terms to update.
$taxonomy
( string ) required – The context of the term.

Returns

true Always true when complete.

Source

File name: wordpress/wp-includes/taxonomy.php
Lines:

1 to 27 of 27
function wp_update_term_count_now( $terms, $taxonomy ) {
  $terms = array_map( 'intval', $terms );

  $taxonomy = get_taxonomy( $taxonomy );
  if ( ! empty( $taxonomy->update_count_callback ) ) {
    call_user_func( $taxonomy->update_count_callback, $terms, $taxonomy );
  } else {
    $object_types = (array) $taxonomy->object_type;
    foreach ( $object_types as &$object_type ) {
      if ( 0 === strpos( $object_type, 'attachment:' ) ) {
        list( $object_type ) = explode( ':', $object_type );
      }
    }

    if ( array_filter( $object_types, 'post_type_exists' ) == $object_types ) {
      // Only post types are attached to this taxonomy.
      _update_post_term_count( $terms, $taxonomy );
    } else {
      // Default count updater.
      _update_generic_term_count( $terms, $taxonomy );
    }
  }

  clean_term_cache( $terms, '', false );

  return true;
}
 

 View on GitHub View on Trac

Published: 25th November 2019 | Last updated: 2nd April 2020

Primary Sidebar

Information

Function name: wp_update_term_count_now
Plugin ref: WordPress
Version: 5.6
Sourcefile: wp-includes/taxonomy.php
File ref: wp-includes/taxonomy.php
Deprecated?: No
API Letters: C,N,T,U,W

Footer

WP-a2z
WordPress core a2z
WordPress core only
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  core.wp-a2z.org
© Copyright WP-a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites