getSiteIds()->map( $applyCallback ); switch_to_blog( $initialBlogId ); return $result; } /** * @return \WPML\Collect\Support\Collection */ public function getSiteIds() { return \wpml_collect( get_sites( [ 'number' => PHP_INT_MAX ] ) )->pluck( 'id' ); } /** * @param int $siteId * @param callable $callback * * @return mixed */ public function executeWith( $siteId, callable $callback ) { switch_to_blog( $siteId ); $result = $callback(); restore_current_blog(); return $result; } }