Skip to content
Docs
Get RestroPress

Filter

rpress_get_addons

Updated
On this page

Filters the list of add-on group terms returned by rpress_get_addons.

Runs after get_terms has queried the addon_category taxonomy using the arguments from rpress_get_addons_args. The value is normally an array of WP_Term objects, but get_terms can also return a WP_Error. The same function is used for top-level groups and, with a parent term ID, for the add-on items within a group.

Parameters#

ParameterTypeDescription
$addonsarray|WP_ErrorTerms returned by get_terms.

Return value#

array|WP_Error. The list of terms.

Example#

function my_get_addons( $addons ) {
	if ( is_wp_error( $addons ) ) {
		return $addons;
	}
	return array_values( array_filter( $addons, function ( $term ) {
		return 'internal-use' !== $term->slug;
	} ) );
}
add_filter( 'rpress_get_addons', 'my_get_addons', 10, 1 );

Source#

Applied in:

  • includes/fooditem-functions.php (line 760), in rpress_get_addons()

See also#

Was this page helpful?