bp_forums_get_topic_id_from_slug

Get the numeric ID of a topic from the topic slug.

Description

(int|bool) bp_forums_get_topic_id_from_slug( (string) $topic_slug ); 

Wrapper for .

Returns (int|bool)

ID of the topic (if found), false on failure.

Parameters (1)

0. $topic_slug (string)
Slug of the topic.

Usage

  1. if ( !function_exists( 'bp_forums_get_topic_id_from_slug' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bp-forums-functions.php'; 
  3.  
  4. // Slug of the topic. 
  5. $topic_slug = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_forums_get_topic_id_from_slug($topic_slug); 
  9.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bp-forums-functions.php  
  1. function bp_forums_get_topic_id_from_slug( $topic_slug ) { 
  2.  
  3. /** This action is documented in bp-forums/bp-forums-screens.php */ 
  4.  
  5. if ( empty( $topic_slug ) ) 
  6. return false; 
  7.  
  8. return bb_get_id_from_slug( 'topic', $topic_slug );