Only display videos and images in the_content() within loop
We can do that with the help of the get_media_embedded_in_content() function: /** * Display only the first media item in the content * * @link http://wordpress.stackexchange.com/a/199398/26350 */ ! is_admin() && add_filter( ‘the_content’, function( $content ) { // Get the avialable media items from the content add_filter( ‘media_embedded_in_content_allowed_types’, ‘wpse_media_types’ ); $media = get_media_embedded_in_content( $content ); remove_filter( … Read more