Posts query loop on front page stuck in alphabetical order?

[ad_1]

Hey all,

So I have a website that has a news page, displaying posts as news on a separate page from the main page which largely displays an events calendar.

However on the front page there is also a small recent posts section that runs a query loop for displaying a small amount of the latest posts.

Despite this query loop on the "Front Page" being set specifically to display news posts in date order (in gutenberg editor), the front page refuses to display it in anything other than alphabetical order.
The "News" page itself works fine and displays the same query loop in date order, so I'm really not sure why this would be the case.

I've even tried to force the main query in functions.php by writing a bit of code to force things, but to no avail:

function fix_front_page_news($query) {
    if ( $query->is_home() && $query->is_main_query() ) {
        $query->set( 'orderby', 'date' );
        $query->set( 'order', 'DESC' );
    }
}
add_action( 'pre_get_posts', 'fix_front_page_news' );

I can post the website if anyone is willing and able to take a look at what's going on? But before I do that if there's something obvious that I've missed that I should try first it's probably better.

I'm using a child theme of my own based on Twenty Twenty Four. I just add custom css files per page and load them via functions.php. Otherwise it's mostly just Twenty Twenty Four untouched (I don't know enough php etc to customise the actual site editor or anything like that).

The front page does use a quite niche plugin to display events from another website on it, but even when deactivating that, and in fact deactivating all plugins nothing changes and it's still stuck on alphabetical.

My Plugins list:

ACF
Envira Gallery Lite
Font Awesome
Forminator
Gtranslate
hCaptcha for WP
ICS Calendar
Post SMTP
Squat Radar calendar integration
Updraft Plus
Wordfence
WP Optimize

The squat radar integration is the only unconventional plugin in that list, and it is used on the front page, but as mentioned, when disabled and even deleted, it does not change the fact that the news posts are stuck in alphabetical order.

Please let me know if any other information might help.

Thanks in advance for any help or insights you might have.

[ad_2]
1 Comment
  1. Is the frontpage block governed by a plugin or a theme that might disregard your query changes?

 

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