• Mlp_Advanced_Translator_Data::save should be ignored on remote post

    so we need to add some code to Mlp_Advanced_Translator_Data::is_valid_save_request

    
    	private function is_valid_save_request( WP_Post $post ) {
    
    		static $called = 0;
    
    		// For auto-drafts, 'save_post' is called twice, resulting in doubled drafts for translations.
    		$called += 1;
    
    		if ( ! empty( $this->post_request_data['original_post_status'] )
    		     && 'auto-draft' === $this->post_request_data['original_post_status']
    		     && 1 < $called
    		) {
    			return false;
    		}
    
    		if ( empty( $this->post_request_data ) ) {
    			return false;
    		}
    
    		if ( empty( $this->post_request_data[ $this->name_base ] ) ) {
    			return false;
    		}
    
    		if ( ! is_array( $this->post_request_data[ $this->name_base ] ) ) {
    			return false;
    		}
    
    		// We only need this when the post is published or drafted.
    		if ( ! $this->is_connectable_status( $post ) ) {
    			return false;
    		}
    
    		if ( ms_is_switched() )// add this lines
    			return false;
    
    		return true;
    	}
    
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Mlp_Advanced_Translator_Data::save called on remote post’ is closed to new replies.