Yoast\WP\SEO\Builders

Indexable_Post_Builder::get_permalink()protectedYoast 1.0

Retrieves the permalink for a post with the given post type and ID.

Метод класса: Indexable_Post_Builder{}

Хуков нет.

Возвращает

false|Строку|WP_Error. The permalink.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_permalink( $post_type, $post_id );
$post_type(строка) (обязательный)
The post type.
$post_id(int) (обязательный)
The post ID.

Код Indexable_Post_Builder::get_permalink() Yoast 22.4

protected function get_permalink( $post_type, $post_id ) {
	if ( $post_type !== 'attachment' ) {
		return \get_permalink( $post_id );
	}

	return \wp_get_attachment_url( $post_id );
}