Make WordPress Core


Ignore:
Timestamp:
04/26/2022 02:02:14 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Docs: Add missing documentation for WP_*_Query::get_search_sql() method parameters.

Includes renaming the $cols parameter to $columns for consistency across the classes.

Follow-up to [42876], [53272-53276].

See #54729.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-user-query.php

    r53276 r53280  
    869869     * @global wpdb $wpdb WordPress database abstraction object.
    870870     *
    871      * @param string $search
    872      * @param array  $cols
    873      * @param bool   $wild   Whether to allow wildcard searches. Default is false for Network Admin, true for single site.
    874      *                       Single site allows leading and trailing wildcards, Network Admin only trailing.
     871     * @param string   $search  Search string.
     872     * @param string[] $columns Array of columns to search.
     873     * @param bool     $wild    Whether to allow wildcard searches. Default is false for Network Admin, true for single site.
     874     *                          Single site allows leading and trailing wildcards, Network Admin only trailing.
    875875     * @return string
    876876     */
    877     protected function get_search_sql( $search, $cols, $wild = false ) {
     877    protected function get_search_sql( $search, $columns, $wild = false ) {
    878878        global $wpdb;
    879879
     
    883883        $like          = $leading_wild . $wpdb->esc_like( $search ) . $trailing_wild;
    884884
    885         foreach ( $cols as $col ) {
    886             if ( 'ID' === $col ) {
    887                 $searches[] = $wpdb->prepare( "$col = %s", $search );
     885        foreach ( $columns as $column ) {
     886            if ( 'ID' === $column ) {
     887                $searches[] = $wpdb->prepare( "$column = %s", $search );
    888888            } else {
    889                 $searches[] = $wpdb->prepare( "$col LIKE %s", $like );
     889                $searches[] = $wpdb->prepare( "$column LIKE %s", $like );
    890890            }
    891891        }
Note: See TracChangeset for help on using the changeset viewer.