loop_no_results WordPress Action Hook

The loop_no_results hook is triggered when the WordPress loop fails to find any posts to display. This can happen when a search returns no results, or when there are no posts in the specified category. When this hook is triggered, it can be used to display a custom message or run a custom function.

do_action( 'loop_no_results', WP_Query $query ) #

Fires if no results are found in a post query.


Parameters

$query

(WP_Query)The WP_Query instance.


Top ↑

Source

File: wp-includes/class-wp-query.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More