Make WordPress Core

Opened 2 years ago

Last modified 2 months ago

#55922 new enhancement

Update wp_list_comments type parameter to allow array or string

Reported by: dshanske's profile dshanske Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 2.7
Component: Comments Keywords: has-patch
Focuses: Cc:

Description

Right now, the options here are all, or a specific comment type. This should allow for multiple comment types as allowed in WP_Comment_Query

Change History (1)

This ticket was mentioned in PR #7054 on WordPress/wordpress-develop by @debarghyabanerjee.


2 months ago
#1

  • Keywords has-patch added; needs-patch removed

Trac Ticket: Core-55922

## Problem

  • The current implementation of the wp_list_comments function restricts the type parameter to a single comment type as either an array or a string, limiting its flexibility for developers who need to query multiple comment types simultaneously.

## Solution

  • This enhancement introduces support for both arrays and strings in the type parameter of the wp_list_comments function. This update leverages the capabilities provided by WP_Comment_Query, allowing developers to specify comment types either as an array of types or as a single type string in a single query efficiently.

## Changes Made

  • Code Enhancement: Updated the wp_list_comments function to accept both arrays and strings for the type parameter.
  • Backend Implementation: Enhanced comment query handling to accommodate arrays and strings passed to the type parameter.

## Impact

  • Enhanced Flexibility: Developers can now specify comment types using either an array of types or a single type string in the wp_list_comments function.
  • Improved Query Capabilities: Facilitates querying multiple comment types simultaneously, leveraging the capabilities of WP_Comment_Query.
  • Expanded Usage Scenarios: Supports a wider range of use cases where querying comments from multiple types is required within a single function call.
  • Backward Compatibility: Ensures compatibility with existing usage of the wp_list_comments function by retaining support for single type string parameter.
Note: See TracTickets for help on using tickets.