-
-
Save searchwpgists/48d27715140d7a19cc37e0dfca99fd44 to your computer and use it in GitHub Desktop.
Customize the image for taxonomy term results
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter( 'searchwp\results\entry\data', function( $data, $result ) { | |
| // Check if the result is a taxonomy term. | |
| if ( $result instanceof \WP_Term ) { | |
| // Replace default image HTML with a placeholder. | |
| $data['image_html'] = '<img src="http://place-hold.it/500x500" />'; | |
| } | |
| return $data; | |
| }, 20, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment