Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. function gdt_blocks_class_rename() {
  2. if ( current_user_can( 'contributor' ) || current_user_can('author') ) {
  3. wp_enqueue_script( 'gdt-plugin-blacklist-blocks', get_stylesheet_directory_uri() . '/custom-js/guten-addons.js', array( 'wp-blocks', 'wp-hooks', 'wp-element', 'wp-edit-post' ));
  4. }
  5. }
  6. add_action( 'enqueue_block_editor_assets', 'gdt_blocks_class_rename' );
  7.  
  8. ( function( wp ) {
  9.  
  10. function modifyLinkDestinationDefault(settings, name) {
  11. if (name !== "core/image") {
  12. return settings;
  13. }
  14.  
  15. settings.attributes.linkDestination.default = "media";
  16.  
  17. return settings;
  18. }
  19.  
  20. wp.hooks.addFilter(
  21. "blocks.registerBlockType",
  22. "my-plugin/modify-linkDestination-default",
  23. modifyLinkDestinationDefault
  24. );
  25.  
  26. } )( window.wp );
  27.  
  28.  
  29. ( function( wp ) {
  30.  
  31. function modifyLinkDestinationGalleyDefault(settings, name) {
  32. if (name !== "core/gallery") {
  33. return settings;
  34. }
  35.  
  36. settings.attributes.linkTo.default = "media";
  37.  
  38. return settings;
  39. }
  40.  
  41. wp.hooks.addFilter(
  42. "blocks.registerBlockType",
  43. "my-plugin/modify-linkDestination-gallery-default",
  44. modifyLinkDestinationGalleyDefault
  45. );
  46.  
  47. } )( window.wp );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement