Version Description
(Feb 11, 2013) = * Updated to match YouTube's new URL structure
Download this release
Release Info
Developer | sparkweb |
Plugin | Hide YouTube Related Videos |
Version | 1.1 |
Comparing to | |
See all releases |
Code changes from version 1.0 to 1.1
- hide-youtube-related-videos.php +17 -16
- readme.txt +12 -3
hide-youtube-related-videos.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Hide YouTube Related Videos
|
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/hide-youtube-related-videos/
|
5 |
Description: This is a simple plugin to keep the YouTube oEmbed from showing related videos.
|
6 |
Author: SparkWeb Interactive, Inc.
|
7 |
-
Version: 1.
|
8 |
Author URI: http://www.soapboxdave.com/
|
9 |
|
10 |
**************************************************************************
|
@@ -30,25 +30,26 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
30 |
//The Filter That Does the Work
|
31 |
add_filter( 'oembed_result', 'hide_youtube_related_videos', 10, 3);
|
32 |
function hide_youtube_related_videos($data, $url, $args = array()) {
|
33 |
-
|
|
|
34 |
}
|
35 |
|
36 |
|
37 |
-
//On Activation, all oembed caches are cleared
|
38 |
register_activation_hook(__FILE__, 'hide_youtube_related_videos_activation');
|
39 |
function hide_youtube_related_videos_activation() {
|
40 |
-
global $wpdb;
|
41 |
-
|
42 |
-
$post_ids = $wpdb->get_col( "SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key LIKE '_oembed_%'" );
|
43 |
-
if ( $post_ids ) {
|
44 |
-
$postmetaids = $wpdb->get_col( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key LIKE '_oembed_%'" );
|
45 |
-
$in = implode( ',', array_fill( 1, count($postmetaids), '%d' ) );
|
46 |
-
do_action( 'delete_postmeta', $postmetaids );
|
47 |
-
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_id IN($in)", $postmetaids ) );
|
48 |
-
do_action( 'deleted_postmeta', $postmetaids );
|
49 |
-
foreach ( $post_ids as $post_id )
|
50 |
-
wp_cache_delete( $post_id, 'post_meta' );
|
51 |
-
return true;
|
52 |
-
}
|
53 |
|
54 |
}
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/hide-youtube-related-videos/
|
5 |
Description: This is a simple plugin to keep the YouTube oEmbed from showing related videos.
|
6 |
Author: SparkWeb Interactive, Inc.
|
7 |
+
Version: 1.1
|
8 |
Author URI: http://www.soapboxdave.com/
|
9 |
|
10 |
**************************************************************************
|
30 |
//The Filter That Does the Work
|
31 |
add_filter( 'oembed_result', 'hide_youtube_related_videos', 10, 3);
|
32 |
function hide_youtube_related_videos($data, $url, $args = array()) {
|
33 |
+
$data = preg_replace('/(youtube\.com.*)(\?feature=oembed)(.*)/', '$1?rel=0$3', $data);
|
34 |
+
return $data;
|
35 |
}
|
36 |
|
37 |
|
38 |
+
//On Activation, all oembed caches are cleared
|
39 |
register_activation_hook(__FILE__, 'hide_youtube_related_videos_activation');
|
40 |
function hide_youtube_related_videos_activation() {
|
41 |
+
global $wpdb;
|
42 |
+
|
43 |
+
$post_ids = $wpdb->get_col( "SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key LIKE '_oembed_%'" );
|
44 |
+
if ( $post_ids ) {
|
45 |
+
$postmetaids = $wpdb->get_col( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key LIKE '_oembed_%'" );
|
46 |
+
$in = implode( ',', array_fill( 1, count($postmetaids), '%d' ) );
|
47 |
+
do_action( 'delete_postmeta', $postmetaids );
|
48 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_id IN($in)", $postmetaids ) );
|
49 |
+
do_action( 'deleted_postmeta', $postmetaids );
|
50 |
+
foreach ( $post_ids as $post_id )
|
51 |
+
wp_cache_delete( $post_id, 'post_meta' );
|
52 |
+
return true;
|
53 |
+
}
|
54 |
|
55 |
}
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: sparkweb
|
3 |
Tags: youtube, video, oembed, related
|
4 |
Requires at least: 2.9
|
5 |
-
Tested up to: 3.
|
6 |
-
Stable tag: 1.
|
7 |
This is a simple plugin to keep the YouTube oEmbed from showing related videos.
|
8 |
|
9 |
== Description ==
|
@@ -14,7 +14,7 @@ On activation, the plugin clears the oEmbed cache so that the videos can be succ
|
|
14 |
|
15 |
== Installation ==
|
16 |
|
17 |
-
Copy the folder to your WordPress
|
18 |
'*/wp-content/plugins/*' folder.
|
19 |
|
20 |
1. Activate the plugin in your WordPress admin
|
@@ -24,5 +24,14 @@ Copy the folder to your WordPress
|
|
24 |
|
25 |
== Changelog ==
|
26 |
|
|
|
|
|
|
|
27 |
= 1.0 (Dec 23, 2011) =
|
28 |
* Initial Release
|
|
|
|
|
|
|
|
|
|
|
|
2 |
Contributors: sparkweb
|
3 |
Tags: youtube, video, oembed, related
|
4 |
Requires at least: 2.9
|
5 |
+
Tested up to: 3.5.1
|
6 |
+
Stable tag: 1.1
|
7 |
This is a simple plugin to keep the YouTube oEmbed from showing related videos.
|
8 |
|
9 |
== Description ==
|
14 |
|
15 |
== Installation ==
|
16 |
|
17 |
+
Copy the folder to your WordPress
|
18 |
'*/wp-content/plugins/*' folder.
|
19 |
|
20 |
1. Activate the plugin in your WordPress admin
|
24 |
|
25 |
== Changelog ==
|
26 |
|
27 |
+
= 1.1 (Feb 11, 2013) =
|
28 |
+
* Updated to match YouTube's new URL structure
|
29 |
+
|
30 |
= 1.0 (Dec 23, 2011) =
|
31 |
* Initial Release
|
32 |
+
|
33 |
+
|
34 |
+
== Upgrade Notice ==
|
35 |
+
|
36 |
+
= 1.1 =
|
37 |
+
Updated to match YouTube's new URL structure
|