$rewrite ) { if( false !== strpos( $rewrite, 'embed=true' ) ) { unset( $rules[ $rule ] ); } } return $rules; } /** * Filters the query variables to remove the 'embed' query variable. * This modification ensures that the 'embed' parameter is excluded * from the recognized query variables within WordPress, potentially * disabling embed functionalities. * * @param array $vars An array of existing query variables. * * @return array The filtered array of query variables. */ public function query_vars( array $vars ): array { return array_diff( $vars, [ 'embed' ] ); } /** * Filters the list of TinyMCE plugins to remove the embed functionality. * This method removes the 'wpembed' plugin from the list of TinyMCE plugins, * effectively disabling embed-related features in the TinyMCE editor. * * @param array $plugins The list of TinyMCE plugins currently enabled. * * @return array The filtered list of TinyMCE plugins with 'wpembed' removed. */ public function tiny_mce_plugins( array $plugins ): array { return array_diff( $plugins, [ 'wpembed' ] ); } /** * Removes specific oEmbed REST API endpoints from the list of registered endpoints. * This method ensures that the '/oembed/1.0/embed' and '/oembed/1.0/proxy' endpoints * are unset, disabling their availability and reducing potential security risks * associated with oEmbed functionality. * * @param array $endpoints An associative array of registered REST API endpoints. * * @return array The modified array of REST API endpoints with specific oEmbed endpoints removed. */ public function rest_endpoints( array $endpoints ): array { unset( $endpoints['/oembed/1.0/embed'] ); unset( $endpoints['/oembed/1.0/proxy'] ); return $endpoints; } }