elementor / elementor/wp2static
Oembeds
- Dominant language
- PHP
- Stars
- 1.5k
- Forks
- 294
- PR merge metrics
- No merged PRs in 30d
Description
WordPress is using oEmbed feature - which in results adds oEmbed discovery urls to website header, which are based on the REST API:
```
```
of course those won't work with the static website, because of obvious reasons. I would either add those filters when wp2static is enabled:
```
//Remove the REST API endpoint.
remove_action('rest_api_init', 'wp_oembed_register_route');
// Turn off oEmbed auto discovery.
add_filter( 'embed_oembed_discover', '__return_false' );
//Don't filter oEmbed results.
remove_filter('oembed_dataparse', 'wp_filter_oembed_result', 10);
//Remove oEmbed discovery links.
remove_action('wp_head', 'wp_oembed_add_discovery_links');
//Remove oEmbed JavaScript from the front-end and back-end.
remove_action('wp_head', 'wp_oembed_add_host_js');
```
or maybe only disabling it when the page is crawled by wp2static crawler - something like:
```php
if ( $_SERVER['HTTP_USER_AGENT'] === `WP2Static.com' ) {
//Remove the REST API endpoint.
remove_action('rest_api_init', 'wp_oembed_register_route');
// Turn off oEmbed auto discovery.
add_filter( 'embed_oembed_discover', '__return_false' );
//Don't filter oEmbed results.
remove_filter('oembed_dataparse', 'wp_filter_oembed_result', 10);
//Remove oEmbed discovery links.
remove_action('wp_head', 'wp_oembed_add_discovery_links');
//Remove oEmbed JavaScript from the front-end and back-end.
remove_action('wp_head', 'wp_oembed_add_host_js');
}
```
Contributor guide
Assessment
This issue has not been assessed yet.