Adding sticky post at the beginning of a custom query?

I have a custom post type called “news”. I have a custom block which displays the latest 4 news posts. I’ve installed the Sticky Posts Switch plugin and enabled sticky posts for that CPT. But I’m having a hard time setting up my query args to show any sticky posts first, followed by the latest posts. up to 4 posts in total. Has anybody managed to get this working correctly?

This is my current args.

$args = [

‘post_type’ => ‘news,

‘post_status’ => ‘publish’,

‘posts_per_page’ => 4,

‘order’ => ‘DESC’,

‘orderby’ => ‘date’,

‘no_found_rows’ => true,
];

$sticky = get_option( ‘sticky_posts’ );

$args[‘post__in’] = $sticky;

$query = new WP_Query( $args );

 

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