Saturday, July 23, 2022
HomeWordPress Developmenttags - wp_get_canonical_url displaying first url of the publish for customized web...

tags – wp_get_canonical_url displaying first url of the publish for customized web page


I’ve created a tag.php web page within the theme. It is working completely. I get the tags publish on the web page.

Now I’ve added the under hyperlink to the header.php web page.

<hyperlink rel="alternate" hreflang="en-US" href="<?php echo wp_get_canonical_url(); ?>"/>

The above code is displaying the canonical URL completely on all of the pages however after I open my tag web page then it is not displaying the canonical URL. It is displaying the primary URL of the publish

Any thought what’s the subject?

tag.php code under

<?php
   /**
   * A Easy tag Template
   */
   get_header(); 

?>  
<div id="main" class="content-area">
   <essential id="essential" class="site-main">

    <part class="resource-container" id="light-header">


        <div class="container">
            <?php $tag = get_queried_object();?>
            <h1><?php echo $tag->identify; ?></h1>
       </div> 
          
 </part> 

   </essential>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments