Ordering isn’t applied in AJAX requests
-
I have taxonomy filters on the frontend that are reloaded with ajax but don’t keep their order because the
is_admin()
function returns true on ajax requests.A fix could be to change the condition in your
front_end_order_terms
method from:if ( ! is_admin() && apply_filters( 'yikes_simple_taxonomy_ordering_front_end_order_terms', true ) ) {
To:
if ( ( ! is_admin() || wp_doing_ajax() ) && apply_filters( 'yikes_simple_taxonomy_ordering_front_end_order_terms', true ) ) {
Or:
if ( ! is_admin() && apply_filters( 'yikes_simple_taxonomy_ordering_front_end_order_terms', true ) || apply_filters( 'taxonomy_ordering_ajax', false ) ) {
And developers can then do something like…
add_filter( 'taxonomy_ordering_ajax' '__return_true' ); get_terms() add_filter( 'taxonomy_ordering_ajax' '__return_false' );
- The topic ‘Ordering isn’t applied in AJAX requests’ is closed to new replies.