humanmade/protected-embeds

Name: protected-embeds

Owner: Human Made

Description: A drop-in replacement for WordPress.com protected embeds

Created: 2015-12-07 15:21:38.0

Updated: 2018-05-08 21:11:08.0

Pushed: 2017-04-07 04:37:49.0

Homepage: null

Size: 21

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Protected Embeds

A drop-in replacement for WordPress.com protected embeds
A Human Made project. Maintained by @joehoyle & @roborourke.
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.
ne( '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:

reate a dummy site object pointing the protected embeds domain
o the primary site
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;
0, 3 );

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.