Users of elementor page builder have a lot of power and flexibility while creating websites until that point when you are faced with a challenge of ordering your content based on a custom field. You may feel trapped; but thanks to WordPress and its wonderful hook system. There is almost always a way around.

add_action( 'elementor/query/sorted_by_date', function( $query ) {
	
  $query->set( 'meta_key', 'sort_date' );
  $query->set( 'orderby', 'meta_value_num' );
  $query->set( 'order', 'ASC' );

});

The code above helps you create a function to help you sort a bunch of post content based on a custom field (sort_date) using the Elementor ID – sorted_by_date

Share this post