Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $data = parse_signed_request($_REQUEST['signed_request']);
- $fb_id = intval( $data["page"]["id"] );
- $sites = wp_get_sites();
- foreach( $sites as $site ) {
- switch_to_blog( $site['blog_id'] );
- $fb_page = get_option( 'fb_pages' );
- $fb_page_id = $fb_page['fb_page_id'];
- if ( $fb_id == $fb_page_id ) {
- $args = array(
- 'numberposts' => 1,
- 'post_type' => 'tab',
- );
- $tabs = get_posts( $args );
- if ( $tabs ) {
- foreach ( $tabs as $tab) {
- wp_redirect( get_permalink( $tab->ID ), 301 );
- exit;
- }
- }
- }
- restore_current_blog();
- }
Add Comment
Please, Sign In to add comment