BP_REST_Activity_Endpoint::bp_rest_activity_remove_lazyload( string $content, BP_Activity_Activity $activity )

Removed lazyload from link preview embed.

Description

Parameters

$content

(string) (Required) Activity Content.

$activity

(BP_Activity_Activity) (Required) Activity object.

Return

(null|string|string[])

Source

File: bp-activity/classes/class-bp-rest-activity-endpoint.php

	public function bp_rest_activity_remove_lazyload( $content, $activity ) {
		$link_embed = bp_activity_get_meta( $activity->id, '_link_embed', true );

		if ( empty( $link_embed ) ) {
			return $content;
		}

		$content = preg_replace( '/iframe(.*?)data-lazy-type="iframe"/is', 'iframe$1', $content );
		$content = preg_replace( '/iframe(.*?)class="lazy/is', 'iframe$1class="', $content );
		$content = preg_replace( '/iframe(.*?)data-src=/is', 'iframe$1src=', $content );

		return $content;
	}

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.