Title: almostdaniel's Replies | WordPress.org

---

# almostdaniel

  [  ](https://wordpress.org/support/users/almostdaniel/)

 *   [Profile](https://wordpress.org/support/users/almostdaniel/)
 *   [Topics Started](https://wordpress.org/support/users/almostdaniel/topics/)
 *   [Replies Created](https://wordpress.org/support/users/almostdaniel/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/almostdaniel/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/almostdaniel/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/almostdaniel/engagements/)
 *   [Favorites](https://wordpress.org/support/users/almostdaniel/favorites/)

 Search replies:

## Forum Replies Created

Viewing 1 replies (of 1 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [setup_postdata problem](https://wordpress.org/support/topic/setup_postdata-problem/)
 *  [almostdaniel](https://wordpress.org/support/users/almostdaniel/)
 * (@almostdaniel)
 * [18 years, 3 months ago](https://wordpress.org/support/topic/setup_postdata-problem/#post-679067)
 * I am attempting to use setup_postdata as well. It looks like it’s not quite rock
   solid. I took a more hamhanded approach, and it seems to work ok.
 *     ```
       // My new post is stored in $pagepost
   
       $stored_post = clone $GLOBALS['post'];
       $GLOBALS['post'] = $pagepost;
       setup_postdata($pagepost);
   
       // Now I can use all my functions, including the_title(), etc.
       // When I'm done...
   
       $GLOBALS['post'] = clone $stored_post;
       ```
   
 * No idea why this works, but it just seems that either setup_postdata doesn’t 
   get all the elements in the right place or the other template functions (e.g.,
   the_title(), etc.) seem to ignore what setup_postdata does.

Viewing 1 replies (of 1 total)