WooCommerce Product Category Archive Issue

[ad_1]

All of a sudden, my products are not arranged properly and seemingly ordered by random, all my category pages are messed up. Can’t even force them to sort A-Z via filter.

However, if i just click edit and update them without changing anything, they seemingly get back to order.

Another issue is i have a couple categories that i need to be descending. I wrote a code snippet for it in my functions.php file, but since 4 days ago it’s not reading it.

Here is the code :

function custom_bridal_category_product_sorting($query) {
if (is_product_category(‘bridal’)) {

// Change the orderby parameter to ‘title’ for Z-A sorting

$query->set(‘orderby’, ‘title’);

$query->set(‘order’, ‘DESC’);

}

}

add_action(‘pre_get_posts’, ‘custom_bridal_category_product_sorting’);

Anyone has any idea what is going on, help would be much appreciated.

Sorry for bad formatting, I’m in mobile.

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer