PluginProbe
Polylang / 3.1
Polylang v3.1
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-block-editor.php +2 -2 3.03.1 View file →
@@ -31,9 +31,9 @@
31 31 public function __construct( &$polylang ) {
32 32 $this->model = &$polylang->model;
33 33 $this->pref_lang = &$polylang->pref_lang;
34 34
35 - add_filter( 'block_editor_preload_paths', array( $this, 'preload_paths' ), 10, 2 );
35 + new PLL_Block_Editor_Filter_Preload_Paths( array( $this, 'preload_paths' ), 10, 2 );
36 36 }
37 37
38 38 /**
39 39 * Filters the preload REST requests by the current language of the post.
@@ -46,9 +46,9 @@
46 46 * @param WP_Post $post The post resource data.
47 47 * @return (string|string[])[]
48 48 */
49 49 public function preload_paths( $preload_paths, $post ) {
50 - if ( $this->model->is_translated_post_type( $post->post_type ) ) {
50 + if ( $post instanceof WP_Post && $this->model->is_translated_post_type( $post->post_type ) ) {
51 51 $lang = $this->model->post->get_language( $post->ID );
52 52
53 53 if ( ! $lang ) {
54 54 $lang = $this->pref_lang;