Skip to content

Commit

Permalink
Expand coment explaining why methods are called.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterwilsoncc committed Jan 17, 2023
1 parent c82f6d5 commit 60d805d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion includes/classes/DistributorPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,21 @@ public function __construct( $post ) {

$this->site_id = get_current_blog_id();

// Pre-populate the post data to account for switching sites.
if ( ! is_multisite() ) {
return;
}

/*
* Populate the source site data for internal connections.
*
* On multisite installations, call each of the methods using a static
* for internal caching to account for site switching.
*
* This ensures the data returned is for the post used to create this
* object. If the method is subsequently called after `switch_to_blog()`
* then the returned data will relate to the initial site rather than
* the switched site.
*/
$this->get_permalink();
$this->get_post_thumbnail_id();
$this->get_post_thumbnail_url();
Expand Down

0 comments on commit 60d805d

Please sign in to comment.