bp_core_get_post_id_by_slug( $slug )

Get Post id by Post SLUG

Description

Parameters

$slug

(Required)

Return

(array)

Source

File: bp-core/bp-core-functions.php

	function bp_core_get_post_id_by_slug( $slug ) {
		$post_id = array();
		$args    = array(
			'posts_per_page' => 1,
			'post_type'      => 'docs',
			'name'           => $slug,
			'post_parent'    => 0,
		);
		$docs    = get_posts( $args );
		if ( ! empty( $docs ) ) {
			foreach ( $docs as $doc ) {
				$post_id[] = $doc->ID;
			}
		}

		return $post_id;
	}

Changelog

Changelog
Version Description
BuddyBoss 1.0.0 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.