function ordenarPorRubro( $array ) {
global $wpdb;
if (!is_admin() && is_search() && is_main_query()){
$array = “SELECT * FROM $wpdb->posts AS p
LEFT JOIN $wpdb->term_relationships AS r ON (p.ID = r.object_id)
INNER JOIN $wpdb->term_taxonomy AS x ON (r.term_taxonomy_id = x.term_taxonomy_id)
INNER JOIN $wpdb->terms AS t ON (r.term_taxonomy_id = t.term_id)
WHERE p.post_type IN (‘post’, ‘publicacion’)
AND p.post_status = ‘publish’
AND x.taxonomy = ‘rubro’
ORDER BY t.name ASC, p.post_date DESC;”;
return $array;
}
};
add_filter( ‘posts_request’, ‘ordenarPorRubro’,10,1);
Error:
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘ordenarPorRubro’ not found or invalid function name in C:\xampp\htdocs\WP_laguialocalFINAL\wp-includes\class-wp-hook.php on line 288
Help me!
-
This reply was modified 5 years, 7 months ago by romemarce.