Changeset 7546
- Timestamp:
- 07/31/2018 01:54:50 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/gutenberg/functions.php
r7544 r7546 35 35 sprintf( 36 36 'wp.apiFetch.use( function( options, next ) { 37 if ( options.method !== "GET" ) { 38 return Promise.resolve( options.data ); 37 var is_whitelisted_endpoint = options.path.startsWith( "/oembed/1.0/proxy" ) || options.path.startsWith( "/gutenberg/v1/block-renderer" ); 38 39 if ( options.method !== "GET" && ! is_whitelisted_endpoint ) { 40 return Promise.resolve( options.data ); //not sure what this actually should be, etc. 39 41 } 40 42 … … 62 64 } 63 65 add_filter( 'wp_headers', 'disable_x_pingback' ); 64 65 // Embeds need further work.66 add_filter( 'block_categories', function( $cats ) {67 foreach ( $cats as $i => $cat ) {68 if ( $cat['slug'] === 'embed' )69 unset( $cats[$i] );70 }71 return $cats;72 } );73 74 75 66 }); 67 68 /** 69 * Let unauthenticated users embed media in Frontenberg. 70 */ 71 function frontenberg_enable_oembed( $all_caps ) { 72 if ( 73 0 === strpos( $_SERVER['REQUEST_URI'], '/gutenberg/wp-json/oembed/1.0/proxy' ) || 74 0 === strpos( $_SERVER['REQUEST_URI'], '/gutenberg/wp-json/gutenberg/v1/block-renderer/core/archives' ) || 75 0 === strpos( $_SERVER['REQUEST_URI'], '/gutenberg/wp-json/gutenberg/v1/block-renderer/core/latest-comments' ) 76 ) { 77 $all_caps['edit_posts'] = true; 78 } 79 80 return $all_caps; 81 } 82 add_filter( 'user_has_cap', 'frontenberg_enable_oembed' ); 76 83 77 84 /**
Note: See TracChangeset
for help on using the changeset viewer.