Version Description
Download this release
Release Info
| Developer | swissspidy |
| Plugin | |
| Version | 1.3.0 |
| Comparing to | |
| See all releases | |
Version 1.3.0
- README.md +74 -0
- composer.json +7 -0
- disable-embeds.php +108 -0
README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Disable Embeds #
|
| 2 |
+
Contributors: swissspidy
|
| 3 |
+
Donate link: https://pascalbirchler.com
|
| 4 |
+
Tags: embed, embeds, oembed
|
| 5 |
+
Requires at least: 4.4
|
| 6 |
+
Tested up to: 4.9
|
| 7 |
+
Stable tag: trunk
|
| 8 |
+
License: GPLv2 or later
|
| 9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
+
|
| 11 |
+
Don’t like the enhanced embeds in WordPress 4.4? Easily disable the feature using this plugin.
|
| 12 |
+
|
| 13 |
+
## Description ##
|
| 14 |
+
|
| 15 |
+
What this plugin does:
|
| 16 |
+
|
| 17 |
+
* Prevents others from embedding your site.
|
| 18 |
+
* Prevents you from embedding other non-whitelisted sites.
|
| 19 |
+
* Disables all JavaScript related to the feature.
|
| 20 |
+
|
| 21 |
+
Just activate the plugin and you’re good to go.
|
| 22 |
+
|
| 23 |
+
Want embeds back again? Simply deactivate the plugin.
|
| 24 |
+
|
| 25 |
+
## Installation ##
|
| 26 |
+
|
| 27 |
+
### Manual Installation ###
|
| 28 |
+
|
| 29 |
+
1. Upload the entire `/disable-embeds` directory to the `/wp-content/plugins/` directory.
|
| 30 |
+
2. Activate Disable Embeds through the 'Plugins' menu in WordPress.
|
| 31 |
+
|
| 32 |
+
## Frequently Asked Questions ##
|
| 33 |
+
|
| 34 |
+
### Is it really that easy? ###
|
| 35 |
+
|
| 36 |
+
Yes.
|
| 37 |
+
|
| 38 |
+
### What about previous embeds? ###
|
| 39 |
+
|
| 40 |
+
Since WordPress caches all embed codes, previous embeds from other sites will still work. However, your own site’s embeds won’t work at all when using this plugin.
|
| 41 |
+
|
| 42 |
+
## Screenshots ##
|
| 43 |
+
|
| 44 |
+
Sorry, there are no screenshots for this plugin! Everything is done behind the scenes.
|
| 45 |
+
|
| 46 |
+
## Changelog ##
|
| 47 |
+
|
| 48 |
+
### 1.3.0 ###
|
| 49 |
+
* Updated against WordPress 4.6 Beta 2
|
| 50 |
+
* Removes a new embeds filter introduced in WordPress 4.5.3
|
| 51 |
+
|
| 52 |
+
### 1.2.0 ###
|
| 53 |
+
* Updated against WordPress 4.4 Beta 3.
|
| 54 |
+
* Removes all embeds rewrite rules on plugin activation.
|
| 55 |
+
|
| 56 |
+
### 1.1.0 ###
|
| 57 |
+
* Updated against WordPress 4.4 Beta 2.
|
| 58 |
+
|
| 59 |
+
### 1.0.0 ###
|
| 60 |
+
* Initial release.
|
| 61 |
+
|
| 62 |
+
## Upgrade Notice ##
|
| 63 |
+
|
| 64 |
+
### 1.3.0 ###
|
| 65 |
+
Removes a new embeds filter that was added in WordPress 4.5.3
|
| 66 |
+
|
| 67 |
+
### 1.2.0 ###
|
| 68 |
+
Now removes all embeds rewrite rules on plugin activation.
|
| 69 |
+
|
| 70 |
+
### 1.1.0 ###
|
| 71 |
+
Updated against WordPress 4.4 Beta 2.
|
| 72 |
+
|
| 73 |
+
### 1.0.0 ###
|
| 74 |
+
Initial release.
|
composer.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "swissspidy/disable-embeds",
|
| 3 |
+
"description": "Don't like the enhanced embeds in WordPress 4.4? Easily disable the feature using this plugin.",
|
| 4 |
+
"version": "1.3.0",
|
| 5 |
+
"type": "wordpress-plugin",
|
| 6 |
+
"license": "GPL-2.0+"
|
| 7 |
+
}
|
disable-embeds.php
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Plugin Name: Disable Embeds
|
| 4 |
+
* Description: Don't like the enhanced embeds in WordPress 4.4? Easily disable the feature using this plugin.
|
| 5 |
+
* Version: 1.3.0
|
| 6 |
+
* Author: Pascal Birchler
|
| 7 |
+
* Author URI: https://pascalbirchler.com
|
| 8 |
+
* License: GPLv2+
|
| 9 |
+
*
|
| 10 |
+
* @package disable-embeds
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Disable embeds on init.
|
| 15 |
+
*
|
| 16 |
+
* - Removes the needed query vars.
|
| 17 |
+
* - Disables oEmbed discovery.
|
| 18 |
+
* - Completely removes the related JavaScript.
|
| 19 |
+
*
|
| 20 |
+
* @since 1.0.0
|
| 21 |
+
*/
|
| 22 |
+
function disable_embeds_init() {
|
| 23 |
+
/* @var WP $wp */
|
| 24 |
+
global $wp;
|
| 25 |
+
|
| 26 |
+
// Remove the embed query var.
|
| 27 |
+
$wp->public_query_vars = array_diff( $wp->public_query_vars, array(
|
| 28 |
+
'embed',
|
| 29 |
+
) );
|
| 30 |
+
|
| 31 |
+
// Remove the REST API endpoint.
|
| 32 |
+
remove_action( 'rest_api_init', 'wp_oembed_register_route' );
|
| 33 |
+
|
| 34 |
+
// Turn off oEmbed auto discovery.
|
| 35 |
+
add_filter( 'embed_oembed_discover', '__return_false' );
|
| 36 |
+
|
| 37 |
+
// Don't filter oEmbed results.
|
| 38 |
+
remove_filter( 'oembed_dataparse', 'wp_filter_oembed_result', 10 );
|
| 39 |
+
|
| 40 |
+
// Remove oEmbed discovery links.
|
| 41 |
+
remove_action( 'wp_head', 'wp_oembed_add_discovery_links' );
|
| 42 |
+
|
| 43 |
+
// Remove oEmbed-specific JavaScript from the front-end and back-end.
|
| 44 |
+
remove_action( 'wp_head', 'wp_oembed_add_host_js' );
|
| 45 |
+
add_filter( 'tiny_mce_plugins', 'disable_embeds_tiny_mce_plugin' );
|
| 46 |
+
|
| 47 |
+
// Remove all embeds rewrite rules.
|
| 48 |
+
add_filter( 'rewrite_rules_array', 'disable_embeds_rewrites' );
|
| 49 |
+
|
| 50 |
+
// Remove filter of the oEmbed result before any HTTP requests are made.
|
| 51 |
+
remove_filter( 'pre_oembed_result', 'wp_filter_pre_oembed_result', 10 );
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
add_action( 'init', 'disable_embeds_init', 9999 );
|
| 55 |
+
|
| 56 |
+
/**
|
| 57 |
+
* Removes the 'wpembed' TinyMCE plugin.
|
| 58 |
+
*
|
| 59 |
+
* @since 1.0.0
|
| 60 |
+
*
|
| 61 |
+
* @param array $plugins List of TinyMCE plugins.
|
| 62 |
+
* @return array The modified list.
|
| 63 |
+
*/
|
| 64 |
+
function disable_embeds_tiny_mce_plugin( $plugins ) {
|
| 65 |
+
return array_diff( $plugins, array( 'wpembed' ) );
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
/**
|
| 69 |
+
* Remove all rewrite rules related to embeds.
|
| 70 |
+
*
|
| 71 |
+
* @since 1.2.0
|
| 72 |
+
*
|
| 73 |
+
* @param array $rules WordPress rewrite rules.
|
| 74 |
+
* @return array Rewrite rules without embeds rules.
|
| 75 |
+
*/
|
| 76 |
+
function disable_embeds_rewrites( $rules ) {
|
| 77 |
+
foreach ( $rules as $rule => $rewrite ) {
|
| 78 |
+
if ( false !== strpos( $rewrite, 'embed=true' ) ) {
|
| 79 |
+
unset( $rules[ $rule ] );
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
return $rules;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
/**
|
| 87 |
+
* Remove embeds rewrite rules on plugin activation.
|
| 88 |
+
*
|
| 89 |
+
* @since 1.2.0
|
| 90 |
+
*/
|
| 91 |
+
function disable_embeds_remove_rewrite_rules() {
|
| 92 |
+
add_filter( 'rewrite_rules_array', 'disable_embeds_rewrites' );
|
| 93 |
+
flush_rewrite_rules();
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
register_activation_hook( __FILE__, 'disable_embeds_remove_rewrite_rules' );
|
| 97 |
+
|
| 98 |
+
/**
|
| 99 |
+
* Flush rewrite rules on plugin deactivation.
|
| 100 |
+
*
|
| 101 |
+
* @since 1.2.0
|
| 102 |
+
*/
|
| 103 |
+
function disable_embeds_flush_rewrite_rules() {
|
| 104 |
+
remove_filter( 'rewrite_rules_array', 'disable_embeds_rewrites' );
|
| 105 |
+
flush_rewrite_rules();
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
register_deactivation_hook( __FILE__, 'disable_embeds_flush_rewrite_rules' );
|
