WPSEO_Admin_Recommended_Replace_Vars::is_homepage()
Determines whether or not a post is the homepage.
Метод класса: WPSEO_Admin_Recommended_Replace_Vars{}
Хуков нет.
Возвращает
true|false
. True if the given post is the homepage.
Использование
// private - только в коде основоного (родительского) класса $result = $this->is_homepage( $post );
- $post(WP_Post) (обязательный)
- The WordPress global post object.
Код WPSEO_Admin_Recommended_Replace_Vars::is_homepage() WPSEO Admin Recommended Replace Vars::is homepage Yoast 23.5
private function is_homepage( $post ) { if ( $post instanceof WP_Post === false ) { return false; } /* * The page on front returns a string with normal WordPress interaction, while the post ID is an int. * This way we make sure we always compare strings. */ $post_id = (int) $post->ID; $page_on_front = (int) get_option( 'page_on_front' ); return get_option( 'show_on_front' ) === 'page' && $page_on_front === $post_id; }