protected function locate() {

		// Don't return a link if embeds don't work. Need media or nothing at all.
		add_filter( 'embed_maybe_make_link', '__return_false' );

		// Get the media if the post type is an attachment.
		if ( 'attachment' === get_post_type( $this->post_id ) ) {
			$this->media = $this->locateSelfMedia();
		}

		// Find media in the post content based on WordPress' media-related shortcodes.
		if ( ! $this->media && $this->shortcodes ) {
			$this->media = $this->locateShortcodeMedia();
		}

		// If no media is found and autoembeds are enabled, check for autoembeds.
		if ( ! $this->media && get_option( 'embed_autourls' ) && $this->autoembeds ) {
			$this->media = $this->locateAutoembedMedia();
		}

		// If no media is found, check for media HTML within the post content.
		if ( ! $this->media && $this->embedded ) {
			$this->media = $this->locatedEmbeddedMedia();
		}

		// If no media is found, check for media attached to the post.
		if ( ! $this->media && $this->attached ) {
			$this->media = $this->locateAttachedMedia();
		}

		// If media is found, let's run a few things.
		if ( $this->media ) {

			// Split the media from the content.
			if ( true === $this->split && ! empty( $this->original_media ) ) {
				add_filter( 'the_content', [ $this, 'split' ], 5 );
			}

			// Filter the media dimensions and add the before/after HTML.
			$this->media = $this->before . $this->filterDimensions( $this->media ) . $this->after;
		}

		// Remove our filter from earlier.
		remove_filter( 'embed_maybe_make_link', '__return_false' );

		return $this->media;
	}
protected function locate() {

		// Don't return a link if embeds don't work. Need media or nothing at all.
		add_filter( 'embed_maybe_make_link', '__return_false' );

		// Get the media if the post type is an attachment.
		if ( 'attachment' === get_post_type( $this->post_id ) ) {
			$this->media = $this->locateSelfMedia();
		}

		// Find media in the post content based on WordPress' media-related shortcodes.
		if ( ! $this->media && $this->shortcodes ) {
			$this->media = $this->locateShortcodeMedia();
		}

		// If no media is found and autoembeds are enabled, check for autoembeds.
		if ( ! $this->media && get_option( 'embed_autourls' ) && $this->autoembeds ) {
			$this->media = $this->locateAutoembedMedia();
		}

		// If no media is found, check for media HTML within the post content.
		if ( ! $this->media && $this->embedded ) {
			$this->media = $this->locatedEmbeddedMedia();
		}

		// If no media is found, check for media attached to the post.
		if ( ! $this->media && $this->attached ) {
			$this->media = $this->locateAttachedMedia();
		}

		// If media is found, let's run a few things.
		if ( $this->media ) {

			// Split the media from the content.
			if ( true === $this->split && ! empty( $this->original_media ) ) {
				add_filter( 'the_content', [ $this, 'split' ], 5 );
			}

			// Filter the media dimensions and add the before/after HTML.
			$this->media = $this->before . $this->filterDimensions( $this->media ) . $this->after;
		}

		// Remove our filter from earlier.
		remove_filter( 'embed_maybe_make_link', '__return_false' );

		return $this->media;
	}
protected function locate ( ) { // Don't return a link if embeds don't work. Need media or nothing at all. add_filter ( 'embed_maybe_make_link' , '__return_false' ) ; // Get the media if the post type is an attachment. if ( 'attachment' === get_post_type ( $ this -> post_id ) ) { $ this -> media = $ this -> locateSelfMedia ( ) ; } // Find media in the post content based on WordPress' media-related shortcodes. if ( ! $ this -> media && $ this -> shortcodes ) { $ this -> media = $ this -> locateShortcodeMedia ( ) ; } // If no media is found and autoembeds are enabled, check for autoembeds. if ( ! $ this -> media && get_option ( 'embed_autourls' ) && $ this -> autoembeds ) { $ this -> media = $ this -> locateAutoembedMedia ( ) ; } // If no media is found, check for media HTML within the post content. if ( ! $ this -> media && $ this -> embedded ) { $ this -> media = $ this -> locatedEmbeddedMedia ( ) ; } // If no media is found, check for media attached to the post. if ( ! $ this -> media && $ this -> attached ) { $ this -> media = $ this -> locateAttachedMedia ( ) ; } // If media is found, let's run a few things. if ( $ this -> media ) { // Split the media from the content. if ( true === $ this -> split && ! empty ( $ this -> original_media ) ) { add_filter ( 'the_content' , [ $ this , 'split' ] , 5 ) ; } // Filter the media dimensions and add the before/after HTML. $ this -> media = $ this -> before . $ this -> filterDimensions ( $ this -> media ) . $ this -> after ; } // Remove our filter from earlier. remove_filter ( 'embed_maybe_make_link' , '__return_false' ) ; return $ this -> media ; }
Tries several methods to find media related to the post.  Returns the
found media.

@since  5.0.0
@access protected
@return string
Tries several methods to find media related to the post . Returns the found media .