Last active
December 26, 2015 13:45
-
-
Save ediamin/5c5c64a993478be53d73 to your computer and use it in GitHub Desktop.
Filter Search Result Post Link
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( 'post_link', 'filter_search_result_post_link', 10, 3 ); | |
function filter_search_result_post_link( $permalink, $post, $leavename ) { | |
if ( is_search() && in_the_loop() ) { | |
$permalink = add_query_arg( 'ref', 'search', $permalink ); | |
} | |
return $permalink; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment