Define orderby in url
-
31-10-2019 - |
题
is there a way to set the order of posts via the url?
/orderby/date/order/desc/
i have tried several things with add_rewrite_rule whiteout success.
add_action( 'init', 'wpse13483_init' );
function wpse13483_init()
{
add_rewrite_rule( 'category/(.+?)/orderby/([^/]+)/order/([^/]+)(/page/?([0-9]{1,}))?/?$', 'index.php?category_name=$matches[1]&paged=$matches[5]&orderby=$matches[2]&order=$matches[3]', 'top' );
}
best, Dan.
没有正确的解决方案