mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
Add function to check if a post is a predefined page
Introduce `um_post_is_predefined_page` to determine if a given post ID corresponds to a predefined page. This enhances functionality by allowing checks against predefined page slugs mapped in the plugin configuration.
This commit is contained in:
@@ -20,6 +20,27 @@ function um_predefined_page_slug_exists( $slug ) {
|
||||
return array_key_exists( $slug, $predefined_pages );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $post_id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function um_post_is_predefined_page( $post_id ) {
|
||||
$predefined_pages = UM()->config()->get( 'predefined_pages' );
|
||||
$predefined_pages = array_keys( $predefined_pages );
|
||||
if ( empty( $predefined_pages ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ( $predefined_pages as $slug ) {
|
||||
if ( um_is_predefined_page( $slug, $post_id ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $slug
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user