forked from tommyskott/please-do-track
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplease-do-track.php
42 lines (36 loc) · 1.21 KB
/
please-do-track.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/*
Plugin Name: Please Do Track!
Plugin URI: https://github.com/tommyskott/please-do-track
Description: A simple WordPress plugin for clearing WordPress oembed cache and disabling "Do Not Track" (dnt), on Vimeo embeds.
Version: 1.2.0
Author: Borgenfalk & Skott
Author URI: https://borgenfalk.se
License: MIT
License URI: https://github.com/tommyskott/please-do-track/blob/master/LICENSE
Text Domain: bs_pls
Domain Path: /languages
*/
defined('ABSPATH') or die('No script kiddies please!');
define('BS_PLS_TXT_DOMAIN', 'bs_pls');
register_activation_hook(__FILE__, function(){
if(is_admin()){
// clear oembed caches
global $wpdb;
$wpdb->query( 'DELETE FROM `' . $wpdb->postmeta . '` WHERE `meta_key` LIKE "_oembed%"' );
}
bs_pls_init();
});
add_action('init', function(){
bs_pls_init();
});
function bs_pls_init(){
load_plugin_textdomain(BS_PLS_TXT_DOMAIN, false, basename(dirname(__FILE__)) . '/languages');
}
add_filter('oembed_fetch_url', function($provider){
if(strpos($provider, 'vimeo.com') !== false){
$provider = remove_query_arg('dnt', $provider);
}
return $provider;
});
?>