interactive-one/protected-embeds

There is no license information available for the latest version (dev-master) of this package.

Installs: 71 089

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 4

Type:wordpress-plugin

dev-master 2023-11-15 02:09 UTC

This package is auto-updated.

Last update: 2024-04-15 03:02:26 UTC


README

Protected Embeds

A drop-in replacement for WordPress.com protected embeds
A Human Made project. Maintained by @roborourke. 68747470733a2f2f686d6e2e6d642f636f6e74656e742f7468656d65732f686d6e6d642f6173736574732f696d616765732f686d2d6c6f676f2e737667

Installation

  1. Install the plugin as normal.
  2. Define PROTECTED_EMBEDS_DOMAIN in your wp-config.php as another domain that points to the same WordPress site. For example myembeds.com.
define( 'PROTECTED_EMBEDS_DOMAIN', 'myembeds.com' );

Dealing with early redirects

In WordPress multisite with a domain mapping solution such as Mercator running you may find requests to your embed domain get redirected too early and adding the domain as a site on the network will negate the benefits of a separate domain if you have SSO enabled. You can work around it by adding the following to your sunrise.php file:

// Create a dummy site object pointing the protected embeds domain
// to the primary site
add_filter( 'pre_get_site_by_path', function( $site, $domain, $path ) {
	if ( PROTECTED_EMBEDS_DOMAIN === $domain ) {
		$site          = new stdClass;
		$site->id      = 1;
		$site->blog_id = 1;
		$site->site_id = 1;
		$site->domain  = $domain;
		$site->path    = $path;
		$site->public  = 1;
	}
	return $site;
}, 10, 3 );