Making WordPress.org

Changeset 7888


Ignore:
Timestamp:
11/23/2018 01:10:37 AM (7 years ago)
Author:
iandunn
Message:

WordCamp Post Site: Return early to avoid PHP notice.

We don't create sites for meetups, so this function should only run for the WordCamp post type.

File:
1 edited

Legend:

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

    r7098 r7888  
    116116     */
    117117    public function maybe_create_new_site( $wordcamp_id ) {
     118        $wordcamp = get_post( $wordcamp_id );
     119
     120        if ( ! $wordcamp instanceof WP_Post || WCPT_POST_TYPE_ID !== $wordcamp->post_type ) {
     121            return;
     122        }
     123
    118124        /*
    119125         * If this were to be called again before it had finished -- e.g., when `WCORMailer::replace_placeholders()`
     
    155161
    156162        $path              = isset( $url_components['path'] ) ? $url_components['path'] : '';
    157         $wordcamp          = get_post( $wordcamp_id );
    158163        $wordcamp_meta     = get_post_custom( $wordcamp_id );
    159164        $lead_organizer    = $this->get_user_or_current_user( $wordcamp_meta['WordPress.org Username'][0] );
Note: See TracChangeset for help on using the changeset viewer.