最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

sanitization - How to use wp_filter_oembed_result?

programmeradmin0浏览0评论

I have a video iframe it's can be youtube , vimeo etc

  $iframe = get_field($field, $id);
                if(empty($iframe)){
                  return;
                }
                preg_match('/src="(.+?)"/', $iframe, $matches);
                $src = $matches[1];
                $params = array(
                    'controls' => 1,
                    'hd'       => 1,
                    'autohide' => 1,
                    'autoplay' => $set_auto,
                );
                apply_filters( 'video_parameters', $params );
                $new_src = add_query_arg($params, $src);
                $iframe  = str_replace($src, $new_src, $iframe);
                $attributes = 'frameborder="0"';
                $iframe     = str_replace('></iframe>', ' ' . $attributes . '></iframe>', $iframe);                
                echo $iframe;

As per documentation i have to use this wp_filter_oembed_result() but i dont know how ..please help

发布评论

评论列表(0)

  1. 暂无评论