bp_document_replace_media_urls( [type] $subj, [type] $searches, [type] $replaces )

Replace the media url and fix serialization if necessary

Description

Parameters

$subj

(Required)

$searches

(Required)

$replaces

(Required)

Return

(void)

Source

File: bp-document/bp-document-functions.php

function bp_document_replace_media_urls( $subj, &$searches, &$replaces ) {
	$subj = is_object( $subj ) ? clone $subj : $subj;

	if ( ! is_scalar( $subj ) && is_countable( $subj ) && count( $subj ) ) {
		foreach ( $subj as &$item ) {
			$item = bp_document_replace_media_urls( $item, $searches, $replaces );
		}
	} else {
		$subj = is_string( $subj ) ? str_replace( $searches, $replaces, $subj ) : $subj;
	}

	return $subj;
}

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.