Core search ‘orderby’
-
Hi!
When I use core search ( search form ) the results are ordered not as I expect. Then I went to core files ( to class-wp-query.php ) I found out strange thing. A lot of conditions was forming $orderby variable in the function get_posts() and it was correct ( I mean it contains “full match in the title, all terms in the title, at least one of the terms in the title, terms in the content). But on the line 2612 this varible is overwrite by string
$orderby = isset( $clauses[ ‘orderby’ ] ) ? $clauses[ ‘orderby’ ] : ”;
And the same happened on the line 2736
$orderby = isset( $clauses[ ‘orderby’ ] ) ? $clauses[ ‘orderby’ ] : ”;
$clauses[‘orderby’] contains simple orderby condition ( like posts by DESC ).
And that little confused me.Can somebody explain me, why is variable $orderby marked as ‘not used’ and be overwrited by strings which I’ve written above ?
Thank yoy in advance.
- The topic ‘Core search ‘orderby’’ is closed to new replies.