WPSEO_Admin_Recommended_Replace_Vars::determine_for_post()
Determines the page type of the current post.
Метод класса: WPSEO_Admin_Recommended_Replace_Vars{}
Хуков нет.
Возвращает
Строку
. The page type.
Использование
$WPSEO_Admin_Recommended_Replace_Vars = new WPSEO_Admin_Recommended_Replace_Vars(); $WPSEO_Admin_Recommended_Replace_Vars->determine_for_post( $post );
- $post(WP_Post) (обязательный)
- A WordPress post instance.
Код WPSEO_Admin_Recommended_Replace_Vars::determine_for_post() WPSEO Admin Recommended Replace Vars::determine for post Yoast 23.4
public function determine_for_post( $post ) { if ( $post instanceof WP_Post === false ) { return 'post'; } if ( $post->post_type === 'page' && $this->is_homepage( $post ) ) { return 'homepage'; } $recommended_replace_vars = $this->get_recommended_replacevars(); if ( array_key_exists( $post->post_type, $recommended_replace_vars ) ) { return $post->post_type; } return 'custom_post_type'; }