Function Reference: gdsc_is_post_type_valid

Summary

Check the post type valid or not.

Parameters

$incoming_post_type
(string) (required) Post type.

Default: None

Return Values

(bool)
  • The boolean equivalent or null.

Change Log

Since: 1.0.0

Source File

gdsc_is_post_type_valid() is located in geodirectory-functions/shortcode_functions.php [Line: 158]

Source Code

function gdsc_is_post_type_valid($incoming_post_type)
{
    $post_types = geodir_get_posttypes();
    $post_types = array_map('geodir_strtolower', $post_types);
    $post_type_found = false;
    foreach ($post_types as $type) {
        if (geodir_strtolower($incoming_post_type) == geodir_strtolower($type)) {
            $post_type_found = true;
        }
    }

    return $post_type_found;
}