save_as_draft( $document, $elements, true ); if ( is_wp_error( $result ) ) { return $result; } if ( ! $result instanceof Document ) { return new \WP_Error( 'elementor_save_failed', __( 'Could not save document.', 'elementor' ), [ 'status' => \WP_Http::INTERNAL_SERVER_ERROR ] ); } return $result; } }