# Elementor Posts Query: Random Order

> Adds a custom query ID "wpide_random" that shows posts in random order in Elementor Pro's Posts and Loop Grid widgets, for testimonials, team members or featured products.

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

## Code

```php
add_action( 'elementor/query/wpide_random', function ( $query ) {
    $query->set( 'orderby', 'rand' );
    $query->set( 'ignore_sticky_posts', true );
    $query->set( 'no_found_rows', true );
} );
```

## Notes

Type wpide_random in the Query ID field. Page caching will freeze the order until the cache is cleared.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Elementor Posts Query: Random Order" 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/
