Title: [Plugin: WordPress Video] validation error
Last modified: August 19, 2016

---

# [Plugin: WordPress Video] validation error

 *  Resolved [smartyd](https://wordpress.org/support/users/smartyd/)
 * (@smartyd)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/plugin-wordpress-video-validation-error/)
 * I’m using the WordPress Video plugin because the validation site didn’t like 
   me inserting an object in my post. But I’m getting the same message from the 
   validation site even though I’m calling the plugin with this simple code (wrapped
   in divs to center it):
 * <div style=”text-align: center;”>[youtube ne6tB2KiZuk]</div>
 * How do I insert a video into a post if not with a plugin?
 * Site is [http://www.theamazingagingmind.com](http://www.theamazingagingmind.com)
   THanks

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [smartyd](https://wordpress.org/support/users/smartyd/)
 * (@smartyd)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/plugin-wordpress-video-validation-error/#post-1530797)
 * This is the Youtube plugin code:
 *     ```
       // Youtube Code
   
       define("YOUTUBE_WIDTH", 260); // default width
       define("YOUTUBE_HEIGHT", 200); // default height
       define("YOUTUBE_REGEXP", "/\[youtube (:print:+)\]/");
       define("YOUTUBE_TARGET", "<object width=\"###WIDTH###\" height=\"###HEIGHT###\"><param name=\"movie\" value=\"http://www.youtube.com/v/###URL###&fs=1&border=1&color1=0x2b405b&color2=0x6b8ab6\" /><param name=\"allowfullscreen\" value=\"true\" /><param name=\"allowscriptaccess\" value=\"always\" /><embed src=\"http://www.youtube.com/v/###URL###&fs=1&border=1&color1=0x2b405b&color2=0x6b8ab6\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"###WIDTH###\" height=\"###HEIGHT###\"></embed></object>");
   
       function youtube_plugin_callback($match)
       {
       	$tag_parts = explode(" ", rtrim($match[0], "]"));
       	$output = YOUTUBE_TARGET;
       	$output = str_replace("###URL###", $tag_parts[1], $output);
       	if (count($tag_parts) > 2) {
       		if ($tag_parts[2] == 0) {
       			$output = str_replace("###WIDTH###", YOUTUBE_WIDTH, $output);
       		} else {
       			$output = str_replace("###WIDTH###", $tag_parts[2], $output);
       		}
       		if ($tag_parts[3] == 0) {
       			$output = str_replace("###HEIGHT###", YOUTUBE_HEIGHT, $output);
       		} else {
       			$output = str_replace("###HEIGHT###", $tag_parts[3], $output);
       		}
       	} else {
       		$output = str_replace("###WIDTH###", YOUTUBE_WIDTH, $output);
       		$output = str_replace("###HEIGHT###", YOUTUBE_HEIGHT, $output);
       	}
       	return ($output);
       }
       function youtube_plugin($content)
       {
       	return (preg_replace_callback(YOUTUBE_REGEXP, 'youtube_plugin_callback', $content));
       }
   
       add_filter('the_content', 'youtube_plugin',1);
       add_filter('the_content_rss', 'youtube_plugin');
       add_filter('comment_text', 'youtube_plugin');
   
       ?>
       ```
   
 * Anyone know what about this is not xhtml compliant?
 *  Thread Starter [smartyd](https://wordpress.org/support/users/smartyd/)
 * (@smartyd)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/plugin-wordpress-video-validation-error/#post-1530841)
 * Well, using advice from this site ([http://www.sohtanaka.com/web-design/valid-xhtml-youtube-embed-code/](http://www.sohtanaka.com/web-design/valid-xhtml-youtube-embed-code/))
   I got the page to validate, but I can’t get it to obey any height and width definition.
   Here is the stripped code that validates:
 *     ```
       // Youtube Code
   
       define("YOUTUBE_REGEXP", "/\[youtube (:print:+)\]/");
       define("YOUTUBE_TARGET", "<object type=\"application/x-shockwave-flash\" data=\"http://www.youtube.com/v/###URL###&fs=1&border=1&color1=0x2b405b&color2=0x6b8ab6\"><param name=\"movie\" value=\"http://www.youtube.com/v/###URL###&fs=1&border=1&color1=0x2b405b&color2=0x6b8ab6\" /></object>");
   
       function youtube_plugin_callback($match)
       {
       	$tag_parts = explode(" ", rtrim($match[0], "]"));
       	$output = YOUTUBE_TARGET;
       	$output = str_replace("###URL###", $tag_parts[1], $output);
       	return ($output);
       }
       function youtube_plugin($content)
       {
       	return (preg_replace_callback(YOUTUBE_REGEXP, 'youtube_plugin_callback', $content));
       }
       add_filter('the_content', 'youtube_plugin',1);
       add_filter('the_content_rss', 'youtube_plugin');
       add_filter('comment_text', 'youtube_plugin');
       ?>
       ```
   
 * I tried adding a “class” inside the object and defining the height and width 
   in the CSS stylesheet, but nothing. Any ideas? Thanks
 *  Thread Starter [smartyd](https://wordpress.org/support/users/smartyd/)
 * (@smartyd)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/plugin-wordpress-video-validation-error/#post-1530846)
 * RESOLVED. Borrowed from the google_video code to achieve the final code for youtube(
   no CSS needed):
 *     ```
       define("YOUTUBE_WIDTH", 260);
       define("YOUTUBE_HEIGHT", 200);
       define("YOUTUBE_REGEXP", "/\[youtube (:print:+)\]/");
       define("YOUTUBE_TARGET", "<object type=\"application/x-shockwave-flash\" data=\"http://www.youtube.com/v/###URL###&border=1&color1=0x2b405b&color2=0x6b8ab6\" width=\"".YOUTUBE_WIDTH."\" height=\"".YOUTUBE_HEIGHT."\" ><param name=\"movie\" value=\"http://www.youtube.com/v/###URL###&border=1&color1=0x2b405b&color2=0x6b8ab6\" /></object>");
   
       function youtube_plugin_callback($match)
       {
       	$tag_parts = explode(" ", rtrim($match[0], "]"));
       	$output = YOUTUBE_TARGET;
       	$output = str_replace("###URL###", $tag_parts[1], $output);
       	return ($output);
       }
       function youtube_plugin($content)
       {
       	return (preg_replace_callback(YOUTUBE_REGEXP, 'youtube_plugin_callback', $content));
       }
       add_filter('the_content', 'youtube_plugin',1);
       add_filter('the_content_rss', 'youtube_plugin');
       add_filter('comment_text', 'youtube_plugin');
       ?>
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Plugin: WordPress Video] validation error’ is closed to new replies.

## Tags

 * [object](https://wordpress.org/support/topic-tag/object/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [video](https://wordpress.org/support/topic-tag/video/)

 * 3 replies
 * 1 participant
 * Last reply from: [smartyd](https://wordpress.org/support/users/smartyd/)
 * Last activity: [15 years, 11 months ago](https://wordpress.org/support/topic/plugin-wordpress-video-validation-error/#post-1530846)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
