In functions.php i using this to change width url from youtube:
add_action('save_post', 'set_url_youtube');
function set_url_youtube() {
$post = get_post($post_id);
$content = $post->post_content;
preg_match_all('#(http://www.youtube.com)?/(v/([-|~_0-9A-Za-z]+)|watch?v=([-|~_0-9A-Za-z]+)&?.*?)#i', $content, $urls, PREG_SET_ORDER);
if(is_array($urls)) {
foreach ($urls as $url)
$videos_url[] = $url[0];
}
if (is_array($videos_url)) {
$videos_url = array_unique($videos_url);
rsort($videos_url);
}
if($videos_url) {
foreach ($videos_url as $video_url) {
$content = str_replace($video_url, $video_url.'&w=550', $content);
}
remove_action( 'save_post', 'set_url_youtube' );
wp_update_post( array('ID' => $post_id, 'post_content' => $content) );
add_action( 'save_post', 'set_url_youtube' );
}
}
?>
But when save post is, url http://www.youtube.com/watch?v=KTRPVo0d90w
not change to http://www.youtube.com/watch?v=KTRPVo0d90w&w=550
How to fix it ?
I think you want to change default video width.
You can change default embed video width and height by embed_defaults filter.