bbp_get_public_child_last_id

  • apply_filters( 'bbp_get_public_child_last_id', (int) $child_id, (int) $parent_id, $post_type )

    Source Reference:

    • Component: bbPress :: bbp-core
      File: /bbp-includes/bbp-common-functions.php :: Trac Source Line: 1168
      	$post_status = "'" . join( "', '", $post_status ) . "'";
      
      	// Check for cache and set if needed
      	if ( !$child_id = wp_cache_get( $cache_id, 'bbpress' ) ) {
      		$child_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s' ORDER BY ID DESC LIMIT 1;", $parent_id, $post_type ) );
      		wp_cache_set( $cache_id, $child_id, 'bbpress' );
      	}
      
      	// Filter and return
      	return apply_filters( 'bbp_get_public_child_last_id', (int) $child_id, (int) $parent_id, $post_type );
      }
      
      /**
       * Query the DB and get a count of public children
       *
       * @param int $parent_id Parent id
       * @param string $post_type Post type. Defaults to 'post'
       * @uses bbp_get_topic_post_type() To get the topic post type
       * @uses wp_cache_get() To check if there is a cache of the children count
       * @uses wpdb::prepare() To prepare the query
      

Comments are closed.