wp_targeted_link_rel
Filter HookDescription
Filters the rel values that are added to links with `target` attribute.Hook Information
File Location |
wp-includes/formatting.php
View on GitHub
|
Hook Type | Filter |
Line Number | 3381 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$rel
|
The rel values. |
string
|
$link_html
|
The matched content of the link tag including all HTML attributes. |
Usage Examples
Basic Usage
<?php
// Hook into wp_targeted_link_rel
add_filter('wp_targeted_link_rel', 'my_custom_filter', 10, 2);
function my_custom_filter($rel, $link_html) {
// Your custom filtering logic here
return $rel;
}
Source Code Context
wp-includes/formatting.php:3381
- How this hook is used in WordPress core
<?php
3376 * @since 5.1.0
3377 *
3378 * @param string $rel The rel values.
3379 * @param string $link_html The matched content of the link tag including all HTML attributes.
3380 */
3381 $rel = apply_filters( 'wp_targeted_link_rel', 'noopener', $link_html );
3382
3383 // Return early if no rel values to be added or if no actual target attribute.
3384 if ( ! $rel || ! isset( $atts['target'] ) ) {
3385 return "<a $original_link_html>";
3386 }
PHP Documentation
<?php
/**
* Filters the rel values that are added to links with `target` attribute.
*
* @since 5.1.0
*
* @param string $rel The rel values.
* @param string $link_html The matched content of the link tag including all HTML attributes.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/formatting.php
Related Hooks
Related hooks will be displayed here in future updates.