File Editor
Directories:
.. (Back)
open-graph
schema
twitter
Files:
aioseo-helper.php
asset-helper.php
attachment-cleanup-helper.php
author-archive-helper.php
blocks-helper.php
capability-helper.php
crawl-cleanup-helper.php
curl-helper.php
current-page-helper.php
date-helper.php
environment-helper.php
first-time-configuration-notice-helper.php
home-url-helper.php
image-helper.php
import-cursor-helper.php
import-helper.php
indexable-helper.php
indexable-to-postmeta-helper.php
indexing-helper.php
language-helper.php
meta-helper.php
notification-helper.php
options-helper.php
pagination-helper.php
permalink-helper.php
post-helper.php
post-type-helper.php
primary-term-helper.php
product-helper.php
redirect-helper.php
require-file-helper.php
robots-helper.php
robots-txt-helper.php
sanitization-helper.php
score-icon-helper.php
short-link-helper.php
site-helper.php
social-profiles-helper.php
string-helper.php
taxonomy-helper.php
url-helper.php
user-helper.php
wincher-helper.php
woocommerce-helper.php
wordpress-helper.php
wpdb-helper.php
Create New File
Create
Edit File: permalink-helper.php
<?php namespace Yoast\WP\SEO\Helpers; use Yoast\WP\SEO\Models\Indexable; /** * A helper object for permalinks. */ class Permalink_Helper { /** * Retrieves the permalink for an indexable. * * @param Indexable $indexable The indexable. * * @return string|null The permalink. */ public function get_permalink_for_indexable( $indexable ) { switch ( true ) { case $indexable->object_type === 'post': if ( $indexable->object_sub_type === 'attachment' ) { return \wp_get_attachment_url( $indexable->object_id ); } return \get_permalink( $indexable->object_id ); case $indexable->object_type === 'home-page': return \home_url( '/' ); case $indexable->object_type === 'term': $term = \get_term( $indexable->object_id ); if ( $term === null || \is_wp_error( $term ) ) { return null; } return \get_term_link( $term, $term->taxonomy ); case $indexable->object_type === 'system-page' && $indexable->object_sub_type === 'search-page': return \get_search_link(); case $indexable->object_type === 'post-type-archive': return \get_post_type_archive_link( $indexable->object_sub_type ); case $indexable->object_type === 'user': return \get_author_posts_url( $indexable->object_id ); } return null; } }
Save Changes
Rename File
Rename