Forums

Query Reset after accessing my own data table (2 posts)

  1. chboul
    Member
    Posted 2 years ago #

    I use WP as a CMS for project management. I've created my own table for tracking data and it lives within the wp database. I just use a php include to get the page which accesses the data, and it works fine.

    However, my footer, which displays recent posts, incorrectly shows "no posts." I assume that I've created a problem by opening another connection and query w/o using the appropriate wp functions.

    I tried just adding wp_query_reset(); at the end of my included php file, but no luck. Any suggestions?

  2. vtxyzzy
    Member
    Posted 2 years ago #

    Before your local query, save $wp_query, then restore it after, like this:

    $temp_query = clone $wp_query;
    // Do your own stuff here;
    
    $wp_query = clone $temp_query;

    See if that helps.

Topic Closed

This topic has been closed to new replies.

About this Topic