[wp-trac] [WordPress Trac] #55329: add_clean_index function throws PHP notice error
WordPress Trac
noreply at wordpress.org
Wed Nov 19 08:57:11 UTC 2025
#55329: add_clean_index function throws PHP notice error
-----------------------------+------------------------------
Reporter: gvgvgvijayan | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Upgrade/Install | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses: administration
-----------------------------+------------------------------
Comment (by philipzimmerm56):
## Changes
Added has_index() Function
This function checks if an index exists for a specified column in a table.
It performs a database query using the SHOW INDEX command to determine if
an index is associated with the given column.
Returns true if an index exists for the column, otherwise returns false.
Refactored add_clean_index() Function
The add_clean_index() function now uses has_index() to verify whether an
index already exists on the specified column before attempting to add it.
If the index exists, the function returns early and skips adding the
index, avoiding redundant operations.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55329#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list