[wp-trac] [WordPress Trac] #52253: New filter on wp-db.php
WordPress Trac
noreply at wordpress.org
Fri Jan 8 05:03:35 UTC 2021
#52253: New filter on wp-db.php
-------------------------+-----------------------------
Reporter: guelben | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: 5.6
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
I need to filter the database returned rows for a plugin I am developping.
I cannot accomplish the functionality with current filters. I think that
other devs may benefit from these couples of filters I propose. These
lines of code placed in substitution of lines 2001 to 2006 of wp-db.php do
the job.
{{{
$this->last_result[ $num_rows ] = $row;
/**
* Filters the database returned row in a mysqli context.
*
* @since 5.6.1
* @param object $row Database fetched row.
* @param string $query Database query.
*/
$row = apply_filters( 'returned_row_mysqli', $row, $query
);
$num_rows++;
}
} elseif ( is_resource( $this->result ) ) {
while ( $row = mysql_fetch_object( $this->result ) ) {
$this->last_result[ $num_rows ] = $row;
/**
* Filters the database returned row in a mysql context.
*
* @since 5.6.1
* @param object $row Database fetched row.
* @param string $query Database query.
*/
$row = apply_filters( 'returned_row_mysql', $row, $query
);
$num_rows++;
}}}
Thanks in advance.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52253>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list