| @@ -42,9 +42,9 @@ | ||
| 42 | 42 | |
| 43 | 43 | if ( defined( 'EP_SYNC_CHUNK_LIMIT' ) && is_numeric( EP_SYNC_CHUNK_LIMIT ) ) { |
| 44 | 44 | /** |
| 45 | 45 | * We also sync when we exceed Chunk limit set. |
| 46 | - * This is sometimes useful when posts are generated programatically. | |
| 46 | + * This is sometimes useful when posts are generated programmatically. | |
| 47 | 47 | */ |
| 48 | 48 | add_action( 'ep_after_add_to_queue', [ $this, 'index_sync_on_chunk_limit' ] ); |
| 49 | 49 | } |
| 50 | 50 | /** |
| @@ -204,8 +204,12 @@ | ||
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | $current_blog_id = get_current_blog_id(); |
| 207 | 207 | foreach ( $this->sync_queue as $blog_id => $sync_queue ) { |
| 208 | + if ( empty( $sync_queue ) ) { | |
| 209 | + continue; | |
| 210 | + } | |
| 211 | + | |
| 208 | 212 | if ( $current_blog_id !== $blog_id ) { |
| 209 | 213 | switch_to_blog( $blog_id ); |
| 210 | 214 | } |
| 211 | 215 | |