Bug in Custom Fields query
-
There is a bug in the paging through custom fields
The current code is:
for( $page = 0; $page < $pages; $page++ ) { $current_row = 0; $start = $page * $page_size; $end = $start + $page_size; $pmquery = "SELECT * FROM $wpdb->postmeta WHERE meta_value <> ''";
The query in $pmquery does not include the necessary limit. That line should be:
$pmquery = "SELECT * FROM $wpdb->postmeta WHERE meta_value <> '' LIMIT {$start}, {$page_size}";
Without that, the entire table is repeatedly looped over rather than paged through.
- The topic ‘Bug in Custom Fields query’ is closed to new replies.