Skip to content

Commit

Permalink
Merge pull request #1198 from greenpeace/feature/p4-search-header
Browse files Browse the repository at this point in the history
Custom header on search with no result
  • Loading branch information
lithrel authored Oct 8, 2020
2 parents 675252a + 9cef9f5 commit 8193dfc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ protected function get_posts( $paged = 1 ) : array {

if ( empty( $posts ) ) {
add_action( 'wp_head', 'wp_no_robots' );
if ( ! headers_sent() ) {
header( 'P4-Search: no-results' );
}
return [];
}

Expand Down

0 comments on commit 8193dfc

Please sign in to comment.