wp_cache_incr() WordPress Function

The wp_cache_incr() function is used to increment a numeric value in the WordPress Object Cache. This is useful for storing counters and other such data.

wp_cache_incr( int|string $key, int $offset = 1, string $group = '' ) #

Increments numeric cache item’s value.


Description

Top ↑

See also


Top ↑

Parameters

$key

(int|string)(Required)The key for the cache contents that should be incremented.

$offset

(int)(Optional) The amount by which to increment the item's value.

Default value: 1

$group

(string)(Optional) The group the key is in.

Default value: ''


Top ↑

Return

(int|false) The item's new value on success, false on failure.


Top ↑

Source

File: wp-includes/cache.php

function wp_cache_incr( $key, $offset = 1, $group = '' ) {
	global $wp_object_cache;

	return $wp_object_cache->incr( $key, $offset, $group );
}


Top ↑

Changelog

Changelog
VersionDescription
3.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.