bbp_get_moderators( int $object_id, string $object_type = 'post' )

Get moderators for a specific object ID. Will return global moderators when object ID is empty.


Description Description


Parameters Parameters

$object_id

(Required) Traditionally a post ID

$object_type

(Optional) Type of meta (post,term,user,comment)

Default value: 'post'


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/users/capabilities.php

function bbp_get_moderators( $object_id = 0, $object_type = 'post' ) {

	// Get global moderators
	if ( empty( $object_id ) ) {
		$users = get_users( array(
			'role__in' => bbp_get_moderator_role(),
		) );

	// Get object moderators
	} else {
		$users = get_users( array(
			'include' => bbp_get_moderator_ids( $object_id, $object_type ),
		) );
	}

	// Filter & return
	return (array) apply_filters( 'bbp_get_moderators', $users, $object_id, $object_type );
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.