Title: return values from function
Last modified: August 20, 2016

---

# return values from function

 *  [brian914](https://wordpress.org/support/users/brian914/)
 * (@brian914)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/return-values-from-function/)
 * I am using the is_tree function like shown on the wordpress conditional page.
   I think it used to work, but now somehow does not anymore.
 * I am calling the function like this and don’t get anything.
    `echo 'is_tree(18)
   is: '; echo is_tree( '18' );`
 * But don’t get a true or a false, but just nothing. What could I be doing wrong?
   Could this be cause by something else?
 * Thanks a lot for help with this one. I don’t know too much about debugging php.
   I know the function gets called, but it just doesn’t seem to be returning anything.
 * Here is the actual function:
 *     ```
       function is_tree( $pid ) {      // $pid = The ID of the page we're looking for pages underneath
           global $post;               // load details about this page
   
           if ( is_page($pid) )
               return true;            // we're at the page or at a sub page
   
           $anc = get_post_ancestors( $post->ID );
           foreach ( $anc as $ancestor ) {
               if( is_page() && $ancestor == $pid ) {
                   return true;
               }
           }
   
           return false;  // we arn't at the page, and the page is not an ancestor
       }
       ```
   

The topic ‘return values from function’ is closed to new replies.

## Tags

 * [is_page](https://wordpress.org/support/topic-tag/is_page/)
 * [return value](https://wordpress.org/support/topic-tag/return-value/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [brian914](https://wordpress.org/support/users/brian914/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/return-values-from-function/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
