Make WordPress Core


Ignore:
Timestamp:
06/23/2017 01:54:59 AM (8 years ago)
Author:
boonebgorges
Message:

Introduce loop_no_results action.

This action fires when a WP_Query query returns no results.

Props mgibbs189.
Props #40850.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-query.php

    r40912 r40923  
    31453145            // Do some cleaning up after the loop
    31463146            $this->rewind_posts();
     3147        } elseif ( 0 === $this->post_count ) {
     3148            /**
     3149             * Fires if no results are found in a post query.
     3150             *
     3151             * @since 4.9.0
     3152             *
     3153             * @param WP_Query $this The WP_Query instance.
     3154             */
     3155            do_action( 'loop_no_results', $this );
    31473156        }
    31483157
Note: See TracChangeset for help on using the changeset viewer.