Skip to content

Instantly share code, notes, and snippets.

@searchwpgists
Last active December 9, 2025 10:21
Show Gist options
  • Select an option

  • Save searchwpgists/08eac891d3c47da4dd54221d7916bb45 to your computer and use it in GitHub Desktop.

Select an option

Save searchwpgists/08eac891d3c47da4dd54221d7916bb45 to your computer and use it in GitHub Desktop.
Append custom content for a specific post type
<?php
// Customize SearchWP result entry data for the SearchWP template.
add_filter( 'searchwp\results\entry\data', function( $data, $result ) {
if ( $result instanceof \WP_Post && $result->post_type === 'product' ) {
$data['content'] .= '<p>Free delivery available!</p>';
}
return $data;
}, 20, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment