Problem with wordpress pagination

Don’t stomp on the $wp_query global. Use your own variable to hold your query instead:

$custom_query = new WP_Query( $args );

Then, you can use a little trick to fix pagination. Do this before the loop:

global $wp_query;
// Store it for safekeeping
$temp_wp_query = $wp_query;
// Now blank it out
$wp_query = null;
// Now populate it with your custom query
$wp_query = $custom_query;

Then, after the loop closes, restore the original query object:

$wp_query = $temp_wp_query;

Now, your pagination should work properly.