Custom Message When Query is Empty (Elementor Pro)

Home Elementor Custom Message When Query is Empty (Elementor Pro)

April 4, 2022

In this quick Elementor Pro tutorial I will show you to add a custom message when a post widget query is empty.

GitHub Issue (Custom message when Post widget query is empty):
https://github.com/elementor/elementor/issues/7624

Code Snippets Plugin:
https://wordpress.org/plugins/code-snippets/

JetSmartFilters Video:
https://www.youtube.com/watch?v=fsPYdaqgeGY

Function Code:

				
					// empty query text
add_action('elementor/query/query_results', function($query) {
	$total = $query->found_posts;
	if ($total == 0) {
		echo '<h1 style="text-align:center;">No results found.</h1>';
	}
});
				
			

*Some of the links on this page are affiliate links, meaning we may receive a commission if you follow them. This allows us to continue providing free content and educational resources for you. Thank you for supporting our small business!

More Free Resources

Join Our Community

Wicky Design YouTube

Get our latest videos by subscribing for FREE to our YouTube channel. New videos are uploaded weekly!

Join Our Community

Join now to receive helpful resources, tips, and tutorials in your inbox.

Is it time for a website upgrade?

Is it time for a website upgrade?

Are you giving off the right first impression? Take the quiz to find out how your site measures up.