Title: are_trackbacks()
Last modified: August 19, 2016

---

# are_trackbacks()

 *  [ikiru](https://wordpress.org/support/users/ikiru/)
 * (@ikiru)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/are_trackbacks/)
 * For a theme I’m working on, I want a simple way to tell if a given post — the
   current one — has trackbacks (and/or pingbacks). I thought this would be rather
   simple (or even built into WordPress) but it doesn’t seem to be.
 * If you have a good idea for how to do this, please share it. If not, I’d appreciate
   any feedback on this PHP function.
 *     ```
       function are_trackbacks($comments) {
         foreach ($comments as $comment) {
           if (get_comment_type() != 'comment') {
             return true;
           }
         }
         return false;
       }
       ```
   
 * I’m pretty sure this is failing because of something I don’t understand about`
   foreach` loops, arrays, or `return`. But my thinking was that I could just cycle
   through the “comments” on a post until I found a trackback or pingback (i.e. 
   not having the comment type `comment`), which would cease the loop and make the
   function return true. If the loop went through all the comments and found only
   comments (i.e. only comment type `comment`), it would return false. It seemed
   straight-forward but pretty clearly isn’t working for me.
 * Any help at all is appreciated.

The topic ‘are_trackbacks()’ is closed to new replies.

## Tags

 * [Comments](https://wordpress.org/support/topic-tag/comments/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [pingbacks](https://wordpress.org/support/topic-tag/pingbacks/)
 * [Themes](https://wordpress.org/support/topic-tag/themes/)
 * [trackbacks](https://wordpress.org/support/topic-tag/trackbacks/)

 * 0 replies
 * 1 participant
 * Last reply from: [ikiru](https://wordpress.org/support/users/ikiru/)
 * Last activity: [17 years, 10 months ago](https://wordpress.org/support/topic/are_trackbacks/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
