Prevent modifying query if term not found
This commit is contained in:
@@ -307,10 +307,10 @@ final class Sort {
|
|||||||
} else if ($current_relationship['taxonomy'] === 'category' && isset($wp_query->query['category_name'])) {
|
} else if ($current_relationship['taxonomy'] === 'category' && isset($wp_query->query['category_name'])) {
|
||||||
$term_id = $wp_query->query['category_name'];
|
$term_id = $wp_query->query['category_name'];
|
||||||
}
|
}
|
||||||
if (empty($term_id)) break;
|
if (empty($term_id)) return;
|
||||||
|
|
||||||
$term = get_term_by($term_by, $term_id, $current_relationship['taxonomy']);
|
$term = get_term_by($term_by, $term_id, $current_relationship['taxonomy']);
|
||||||
if (!is_a($term, 'WP_Term')) break;
|
if (!is_a($term, 'WP_Term')) return;
|
||||||
|
|
||||||
$wp_query->set('meta_key', "ogre-sort_{$current_relationship['taxonomy']}_{$term->term_id}");
|
$wp_query->set('meta_key', "ogre-sort_{$current_relationship['taxonomy']}_{$term->term_id}");
|
||||||
$wp_query->set('orderby', 'meta_value_num');
|
$wp_query->set('orderby', 'meta_value_num');
|
||||||
|
|||||||
Reference in New Issue
Block a user