I need to switch WordPress's post context, sort of like switch_to_blog() but for posts. What's the safest way to alter WordPress's global state and switch it back?
Use setup_postdata() to change and wp_reset_postdata() to roll back to original.
get_post( $post_id )
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
5 years ago