# Elementor Posts Query: Only Sticky (Featured) Posts

> Adds a custom query ID "wpide_sticky" that shows only the posts you marked as sticky, so a "Featured articles" section in Elementor Pro stays in sync with the post editor's Sticky option.

- Type: PHP
- Runs: Run everywhere
- Category: [Page Builders & Themes](https://wpide.com/library/category/page-builders/)
- Tags: elementor, query, sticky, featured
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/elementor-query-sticky-posts/

## Code

```php
add_action( 'elementor/query/wpide_sticky', function ( $query ) {
    $sticky = array_filter( array_map( 'absint', (array) get_option( 'sticky_posts', array() ) ) );

    $query->set( 'post__in', $sticky ? $sticky : array( 0 ) );
    $query->set( 'ignore_sticky_posts', true );
    $query->set( 'orderby', 'date' );
} );
```

## Notes

Type wpide_sticky in the Query ID field. When no post is sticky, the widget shows nothing.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Elementor Posts Query: Only Sticky (Featured) Posts" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
