??????????????
??????????????
??????????????
??????????????
Warning : Undefined variable $auth in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
Warning : Trying to access array offset on value of type null in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
??????????????
??????????????
??????????????
??????????????
File Manager
✏️ Edit File: /home/mklsvubc/am1atec.co.uk/wp-content/plugins/surerank/inc/frontend/canonical.php
⬅ Kembali
<?php
/**
* Canonical Meta Data
*
* This file will handle functionality to print meta_data in frontend for different requests.
*
* @package surerank
* @since 0.0.1
*/
namespace SureRank\Inc\Frontend;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
use SureRank\Inc\Traits\Get_Instance;
use WP_Term;
/**
* Canonical URL
* This class will handle functionality to print meta_data in frontend for different requests.
*
* @since 1.0.0
*/
class Canonical {
use Get_Instance;
/**
* Constructor
*
* @since 1.0.0
*/
public function __construct() {
remove_action( 'wp_head', 'rel_canonical' );
remove_action( 'wp_head', 'index_rel_link' );
add_action( 'surerank_print_meta', [ $this, 'print_canonical_url' ], 1, 1 );
}
/**
* Add meta data
*
* @param array<string, mixed> $meta_data Meta Data.
* @since 1.0.0
* @return void
*/
public function print_canonical_url( $meta_data ) {
$url = '';
if ( is_singular() ) {
$url = $meta_data['canonical_url'] ?? get_the_permalink();
}
if ( is_archive() ) {
$taxonomy = get_queried_object();
if ( $taxonomy instanceof \WP_Term ) {
$url = get_term_link( $taxonomy );
}
}
if ( is_home() || is_front_page() ) {
$url = $meta_data['canonical_url'] ?? get_home_url();
}
global $wp;
if ( ! is_404() ) {
if ( is_search() ) {
$url = get_search_link();
} elseif ( is_paged() && is_singular() ) {
$url = $meta_data['canonical_url'] ?? get_permalink();
} elseif ( is_paged() ) {
$url = $meta_data['canonical_url'] ?? get_pagenum_link( get_query_var( 'paged' ) );
} elseif ( is_tax() || is_category() || is_tag() ) {
$queried_object = get_queried_object();
$url = isset( $meta_data['canonical_url'] ) && ! empty( $meta_data['canonical_url'] )
? $meta_data['canonical_url']
: ( $queried_object instanceof WP_Term ? get_term_link( $queried_object ) : '' );
} elseif ( ! is_home() && ! is_front_page() ) {
$url = $meta_data['canonical_url'] ?? user_trailingslashit( home_url( add_query_arg( [], $wp->request ) ) );
}
if ( empty( $url ) ) {
$url = user_trailingslashit( home_url( add_query_arg( [], $wp->request ) ) );
}
}
/**
* Filters the canonical URL before output.
*
* Allows domain-mapping integrations (WPML domain-per-language, WP Landing Kit)
* to supply the correctly mapped canonical URL.
*
* @since 1.7.2
* @param string $url Resolved canonical URL.
* @param array<string, mixed> $meta_data Post meta data for this request.
*/
$url = (string) apply_filters( 'surerank_canonical_url', $url, $meta_data );
$this->print_canonical( $url );
}
/**
* Print the canonical url.
*
* @param string $url Canonical URL.
* @return void
* @since 1.0.0
*/
public function print_canonical( $url ) {
echo '<link rel="canonical" href="' . esc_url( $url ) . '">' . PHP_EOL;
}
}
Nama
Tipe
Ukuran
Diubah
Aksi
🐘 archives-meta.php
php
4.9 KB
2026-06-21 06:40
🐘 archives.php
php
6 KB
2026-06-21 06:40
🐘 author.php
php
2.5 KB
2026-06-21 06:40
🐘 breadcrumbs.php
php
11.4 KB
2026-06-21 06:40
🐘 canonical.php
php
2.9 KB
2026-06-21 06:40
🐘 common.php
php
1.8 KB
2026-06-21 06:40
🐘 content-seo.php
php
10.4 KB
2026-06-21 06:40
🐘 crawl-optimization.php
php
11.2 KB
2026-06-21 06:40
🐘 description.php
php
6.5 KB
2026-06-21 06:40
🐘 facebook.php
php
16.9 KB
2026-06-21 06:40
🐘 feed.php
php
3.7 KB
2026-06-21 06:40
🐘 image-seo.php
php
15.3 KB
2026-06-21 06:40
🐘 image.php
php
7.1 KB
2026-06-21 06:40
🐘 link-seo.php
php
14.1 KB
2026-06-21 06:40
🐘 meta-data.php
php
4 KB
2026-06-21 06:40
🐘 meta-tag-injection.php
php
1.2 KB
2026-06-21 06:40
🐘 product.php
php
2.2 KB
2026-06-21 06:40
🐘 robots.php
php
6.5 KB
2026-06-21 06:40
🐘 seo-popup.php
php
1 KB
2026-06-21 06:40
🐘 single.php
php
1.6 KB
2026-06-21 06:40
🐘 special-page.php
php
5.3 KB
2026-06-21 06:40
🐘 taxonomy.php
php
1.6 KB
2026-06-21 06:40
🐘 title.php
php
6.6 KB
2026-06-21 06:40
🐘 twitter.php
php
5.3 KB
2026-06-21 06:40