Making WordPress.org

Changeset 3023


Ignore:
Timestamp:
04/27/2016 10:35:13 AM (8 years ago)
Author:
kovshenin
Message:

WordCamp.org: When saving a WordCamp post make sure the _site_id mapping is updated.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-new-site.php

    r2964 r3023  
    7676            $url = set_url_scheme( esc_url_raw( $url ), 'https' );
    7777            update_post_meta( $wordcamp_id, $key, esc_url( $url ) );
     78
     79            // If this site exists make sure we update the _site_id mapping.
     80            $path = parse_url( $url, PHP_URL_PATH ) ? parse_url( $url, PHP_URL_PATH ) : '/';
     81            $existing_site_id = domain_exists( parse_url( $url, PHP_URL_HOST ), $path, 1 );
     82            if ( $existing_site_id ) {
     83                update_post_meta( $wordcamp_id, '_site_id', absint( $existing_site_id ) );
     84                return;
     85            }
    7886        }
    7987    }
Note: See TracChangeset for help on using the changeset viewer.