bbp_validate_reply_to( int $reply_to, int $reply_id )

Validate a reply_to field for hierarchical replies

Description

Checks for 2 scenarios: — The reply to ID is actually a reply — The reply to ID does not match the current reply

Parameters

$reply_to

(Required)

$reply_id

(Required)

Return

(int) $reply_to

Source

File: bp-forums/replies/functions.php

function bbp_validate_reply_to( $reply_to = 0, $reply_id = 0 ) {

	// The parent reply must actually be a reply
	if ( ! bbp_is_reply( $reply_to ) ) {
		$reply_to = 0;
	}

	// The parent reply cannot be itself
	if ( $reply_id === $reply_to ) {
		$reply_to = 0;
	}

	return (int) $reply_to;
}

Changelog

Changelog
Version Description
bbPress (r5377) Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.