Filter options for the main query (Post module)

This would allow you to filter the main query similar to what you can do with custom query such as categories, order etc.

Wouldn’t this mean using a custom query, or do you mean ordinary parameters that wouldn’t interfere with the efficiency of the Loop?

It would be things like changing the order or show X posts. This way you could create one layout for several archives where you want to show 20 posts instead of the default 10 without having to create a layout for each archive separately.


Any updates here? I’m trying to customize the main loop as well. I need two different layouts on my archive pages.


Unfortunately, no update at the moment as we’re currently working on some new modules. :slight_smile:

I also need that, would be awesome if you add this feature.

I do it for now like in my code:

Change POST_TYPE_SLUG > slug of your post
Change CUSTOM_FIELD > with field you want to use for sorting

// Order 
add_action( 'pre_get_posts', 'custom_sort_staff' );
function custom_sort_staff( $query ) {
    if ( $query->is_main_query() && !is_admin() ) {
        if ( $query->is_tax() || $query->is_post_type_archive('POST_TYPE_SLUG') ) {
            $query->set('orderby', 'meta_value_num');  
            $query->set('meta_key', 'CUSTOM_FIELD');  
            $query->set('order', 'ASC'); 
1 Like