Function
Determine if an action has an associated page.
tml_action_has_page( string|Theme_My_Login_Action $action = '' )
Parameters
-
$actionstring|Theme_My_Login_Action Default'' - The action name of object.
Return
bool|WP_Post
The page object if one is found, false otherwise.
Source
function tml_action_has_page( $action = '' ) {
$action = tml_get_action( $action );
if ( ! $action ) {
return false;
}
$pages = wp_cache_get( 'pages', 'theme-my-login' );
if ( false === $pages ) {
$pages = get_posts(
array(
'post_name__in' => array_map( 'tml_get_action_slug', tml_get_actions() ),
'post_type' => 'page',
'nopaging' => true,
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
)
);
wp_cache_set( 'pages', $pages, 'theme-my-login' );
}
$pages = wp_list_filter( $pages, array( 'post_name' => $action->get_slug() ) );
if ( $pages ) {
return reset( $pages );
}
return false;
}
Uses
Used by
Changelog
| Version | Description |
|---|---|
| 7.0.1 | Introduced. |