Filter hook 'search_link'

in WP Core File wp-includes/link-template.php at line 1213

View Source

search_link

Filter Hook
Description
Filters the search permalink.

Hook Information

File Location wp-includes/link-template.php View on GitHub
Hook Type Filter
Line Number 1213

Hook Parameters

Type Name Description
string $link Search permalink.
string $search The URL-encoded search term.

Usage Examples

Basic Usage
<?php
// Hook into search_link
add_filter('search_link', 'my_custom_filter', 10, 2);

function my_custom_filter($link, $search) {
    // Your custom filtering logic here
    return $link;
}

Source Code Context

wp-includes/link-template.php:1213 - How this hook is used in WordPress core
<?php
1208  	 * @since 3.0.0
1209  	 *
1210  	 * @param string $link   Search permalink.
1211  	 * @param string $search The URL-encoded search term.
1212  	 */
1213  	return apply_filters( 'search_link', $link, $search );
1214  }
1215  
1216  /**
1217   * Retrieves the permalink for the search results feed.
1218   *

PHP Documentation

<?php
/**
	 * Filters the search permalink.
	 *
	 * @since 3.0.0
	 *
	 * @param string $link   Search permalink.
	 * @param string $search The URL-encoded search term.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/link-template.php
Related Hooks

Related hooks will be displayed here in future updates.