PluginProbe
Polylang / 2.7.3
Polylang v2.7.3
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | admin/admin.php +4 -1 2.7.12.7.3 View file →
@@ -189,8 +189,11 @@
189 189
190 190 /**
191 191 * Load the post synchronization object, depending on the editor in use.
192 192 *
193 + * We must make sure to instantiate the class only once, as the function may be called from a filter,
194 + * and that the synchronization model has been instantiated (due to InfiniteWP messing the actions wp_loaded and admin_init).
195 + *
193 196 * @since 2.6
194 197 *
195 198 * @param bool $is_block_editor Whether to use the block editor or not.
196 199 * @return bool
@@ -195,9 +198,9 @@
195 198 * @param bool $is_block_editor Whether to use the block editor or not.
196 199 * @return bool
197 200 */
198 201 public function _maybe_load_sync_post( $is_block_editor ) {
199 - if ( ! isset( $this->sync_post ) ) { // Make sure to instantiate the class only once, as the function may be called from a filter.
202 + if ( ! isset( $this->sync_post ) && isset( $this->sync_post_model ) ) {
200 203 if ( class_exists( 'PLL_Sync_Post_REST' ) && pll_use_block_editor_plugin() && $is_block_editor ) {
201 204 $this->sync_post = new PLL_Sync_Post_REST( $this );
202 205 } elseif ( class_exists( 'PLL_Sync_Post' ) ) {
203 206 $this->sync_post = new PLL_Sync_Post( $this );