BP_Core_oEmbed_Extension::register_route()
Register the oEmbed REST API route.
Description
Source
File: bp-core/classes/class-bp-core-oembed-extension.php
public function register_route() { /** This filter is documented in wp-includes/class-wp-oembed-controller.php */ $maxwidth = apply_filters( 'oembed_default_width', 600 ); // Required arguments. $args = array( 'url' => array( 'required' => true, 'sanitize_callback' => 'esc_url_raw', ), 'format' => array( 'default' => 'json', 'sanitize_callback' => 'wp_oembed_ensure_format', ), 'maxwidth' => array( 'default' => $maxwidth, 'sanitize_callback' => 'absint', ) ); // Merge custom arguments here. $args = $args + (array) $this->set_route_args(); register_rest_route( 'oembed/1.0', "/embed/{$this->slug_endpoint}", array( array( 'methods' => WP_REST_Server::READABLE, 'callback' => array( $this, 'get_item' ), 'args' => $args ), ) ); }
Changelog
Version | Description |
---|---|
BuddyPress 2.6.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.