| 76 | * Map the oEmbed REST API route to WordPress core infrastructure. |
| 77 | * |
| 78 | * Version 1.x of the WP-API plugin does not support the WordPress 4.4 embed functionality, |
| 79 | * so the oEmbed API endpoint needs to be handled by WordPress core. |
| 80 | * |
| 81 | * @param array $query_vars The array of requested query variables. |
| 82 | * |
| 83 | * @return array |
| 84 | */ |
| 85 | function wcorg_json_map_embed_route_to_core_api( $query_vars ) { |
| 86 | if ( isset( $query_vars['json_route'] ) && '/oembed/1.0/embed' === $query_vars['json_route'] ) { |
| 87 | $query_vars['rest_route'] = $query_vars['json_route']; |
| 88 | unset( $query_vars['json_route'] ); |
| 89 | } |
| 90 | |
| 91 | return $query_vars; |
| 92 | } |
| 93 | add_filter( 'request', 'wcorg_json_map_embed_route_to_core_api' ); |
| 94 | |
| 95 | /** |