BP_XProfile_Field_Type_URL::display_filter( string $field_value, string|int $field_id = '' )
Format URL values for display.
Description
Parameters
- $field_value
-
(string) (Required) The URL value, as saved in the database.
- $field_id
-
(string|int) (Optional) ID of the field.
Default value: ''
Return
(string) URL converted to a link.
Source
File: bp-xprofile/classes/class-bp-xprofile-field-type-url.php
public static function display_filter( $field_value, $field_id = '' ) { $link = strip_tags( $field_value ); $no_scheme = preg_replace( '#^https?://#', '', rtrim( $link, '/' ) ); $url_text = str_replace( $link, $no_scheme, $field_value ); return '<a href="' . esc_url( $field_value ) . '" rel="nofollow noopener" target="_blank">' . esc_html( $url_text ) . '</a>'; }
Changelog
Version | Description |
---|---|
BuddyPress 2.1.0 | BuddyPress 2.1.0 |
BuddyBoss 1.0.0 Added target="_blank" attribute to anchor tag and consequently added noopener to rel attribute | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.