bbp_get_reply_topic_id( int $reply_id )

Return the topic id a reply belongs to

Description

Parameters

$reply_id

(Optional) Reply id

Return

(int) Reply's topic id

Source

File: bp-forums/replies/template.php

	function bbp_get_reply_topic_id( $reply_id = 0 ) {

		// Assume there is no topic id
		$topic_id = 0;

		// Check that reply_id is valid
		if ( $reply_id = bbp_get_reply_id( $reply_id ) )

			// Get topic_id from reply
			if ( $topic_id = get_post_meta( $reply_id, '_bbp_topic_id', true ) )

				// Validate the topic_id
				$topic_id = bbp_get_topic_id( $topic_id );

		return (int) apply_filters( 'bbp_get_reply_topic_id', $topic_id, $reply_id );
	}

Changelog

Changelog
Version Description
bbPress (r2553) 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.