diff --git a/src/bp-core/classes/class-bp-embed.php b/src/bp-core/classes/class-bp-embed.php index e350cf349a..f0622a2055 100644 --- a/src/bp-core/classes/class-bp-embed.php +++ b/src/bp-core/classes/class-bp-embed.php @@ -344,7 +344,7 @@ public function autoembed( $content, $type = '' ) { // Replace line breaks from all HTML elements with placeholders. $content = wp_replace_in_html_tags( $content, array( "\n" => '' ) ); - if ( ! empty( $link_embed ) && preg_match( '#(^|\s|>)https?://#i', $content ) && ! ( strpos( $content, 'download_document_file' ) || strpos( $content, 'download_media_file' ) || strpos( $content, 'download_video_file' ) ) ) { + if ( ! $link_embed && preg_match( '#(^|\s|>)https?://#i', $content ) && ! ( strpos( $content, 'download_document_file' ) || strpos( $content, 'download_media_file' ) || strpos( $content, 'download_video_file' ) ) ) { // Find URLs on their own line. if ( ! $is_activity ) { $content = preg_replace_callback( '|^(\s*)(https?://[^\s<>"]+)(\s*)$|im', array( $this, 'autoembed_callback' ), $content );