dozent_get_post_id( int $post_id )

Get the post id either from given ID or from the WordPress loop


Description

If you pass no parameter or 0 or null, this function will return you the value using get_the_ID() from the standard WordPress Loop or global $post variable

Example usage:

dozent_get_post_id();
dozent_get_post_id( $post_id );

Parameters

$post_id

(int) (Required) Post ID


Return

(bool|false|int)


Source

File: includes/core-functions.php

	function dozent_get_post_id( $post_id = 0 ) {
		if ( ! $post_id ) {
			$post_id = get_the_ID();
			if ( ! $post_id ) {
				return false;
			}
		}

		return $post_id;
	}


Changelog

Changelog
Version Description
DozentLMS 1.0.0 Introduced.