Title: Error with get_permalink()
Last modified: August 31, 2016

---

# Error with get_permalink()

 *  Resolved [filipesoares17](https://wordpress.org/support/users/filipesoares17/)
 * (@filipesoares17)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/error-with-get_permalink/)
 * Hi there.
 * I’m getting an error with the get_permalink() code. I have this code to display
   the link of the page:
 *     ```
       <?php
                   /*global $query_string;
                   query_posts( $query_string . '&order=ASC' );*/
                   $args = array('post_type' => 'page', 'posts_per_page' => '6', 'post__not_in'=>array('3491', '77','73','58') );
                   $loop = new WP_Query($args);
                   while ($loop->have_posts()) : $loop->the_post();
   
                       $feat_image = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
                       ?>
   
                       <li class="col-lg-4 col-md-4 col-sm-6 col-xs-12 prod">
                           <img src="<?php echo $feat_image; ?>">
   
                           <div class="prod_hov col-lg-4 col-md-4 col-sm-6 col-xs-12">
                               <h1><a href="<?php the_field('link'); ?>"><?php the_title(); ?></a></h1>
                           </div>
                           <div class="prod_shad col-lg-4 col-md-4 col-sm-6 col-xs-12">
                               <h1><?php echo get_the_title(); ?></h1>
                               <p><?php the_excerpt(); ?></p>
                               <h2><a href="<?php echo get_permalink(); ?>">saber mais</h2>
                           </div>
   
                       </li>
   
                   <?php endwhile; ?>
       ```
   
 * and the result displays this:
 *     ```
       <li class="col-lg-4 col-md-4 col-sm-6 col-xs-12 prod">
                           <img src="http://localhost:8080/sites/bioportugal/wp-content/uploads/2016/01/ci--ncias-da-vida2.jpg">
   
                           <div class="prod_hov col-lg-4 col-md-4 col-sm-6 col-xs-12">
                               <h1><a href="">CIÊNCIAS DE VIDA</a></h1>
                           </div>
                           <div class="prod_shad col-lg-4 col-md-4 col-sm-6 col-xs-12">
                               <h1>CIÊNCIAS DE VIDA</h1>
                               <p></p><p>Especialmente focados no utilizador de técnicas de Biologia Molecular.</p>
                               <h2><a href="http://localhost:8080/sites/bioportugal/ciencias-de-vida/">saber mais</a></h2><a href="http://localhost:8080/sites/bioportugal/ciencias-de-vida/">
                           </a></div><a href="http://localhost:8080/sites/bioportugal/ciencias-de-vida/">
   
                       </a></li>
       ```
   
 * as you can see the permalink code is duplicating the “a” tag, is there any solution
   to this?
 * Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [stephencottontail](https://wordpress.org/support/users/stephencottontail/)
 * (@stephencottontail)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/error-with-get_permalink/#post-6985652)
 * You’ve forgotten to close off the `<a>` tag near the end of your code:
 * `<h2><a href="<?php echo get_permalink(); ?>">saber mais</h2>`
 * should be
 * `<h2><a href="<?php echo get_permalink(); ?>">saber mais</a></h2>`
 *  Thread Starter [filipesoares17](https://wordpress.org/support/users/filipesoares17/)
 * (@filipesoares17)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/error-with-get_permalink/#post-6985653)
 * damn… thanks :/

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Error with get_permalink()’ is closed to new replies.

## Tags

 * [get_permalink](https://wordpress.org/support/topic-tag/get_permalink/)
 * [link](https://wordpress.org/support/topic-tag/link/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [filipesoares17](https://wordpress.org/support/users/filipesoares17/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/error-with-get_permalink/#post-6985653)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
