Yoast\WP\SEO\Builders
Indexable_Link_Builder::get_post_id()
Get the post ID based on the link's type and its target's permalink.
Метод класса: Indexable_Link_Builder{}
Хуков нет.
Возвращает
int
. The post ID.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_post_id( $type, $permalink );
- $type(строка) (обязательный)
- The type of link (either SEO_Links::TYPE_INTERNAL or SEO_Links::TYPE_INTERNAL_IMAGE).
- $permalink(строка) (обязательный)
- The permalink of the link's target.
Код Indexable_Link_Builder::get_post_id() Indexable Link Builder::get post id Yoast 24.1
protected function get_post_id( $type, $permalink ) { if ( $type === SEO_Links::TYPE_INTERNAL ) { return \url_to_postid( $permalink ); } return $this->image_helper->get_attachment_by_url( $permalink ); }