Skip to content

Commit

Permalink
Create disable-shortcode-pasting.php
Browse files Browse the repository at this point in the history
  • Loading branch information
schlotterer authored Aug 24, 2024
1 parent ee218ef commit 2b0a7e4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions disable-shortcode-pasting.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
/**
* Plugin Name: Disable Shortcode Pasting in Plain Text Blocks
* Description: Prevents automatic shortcode blocks from being inserted when pasting into plain text blocks like paragraphs or headings.
* Version: 1.0
* Author: Your Name
*/

function dsp_enqueue_block_editor_assets() {
wp_enqueue_script(
'dsp-shortcode-paste-handler',
plugin_dir_url(__FILE__) . 'shortcode-paste-handler.js',
array('wp-blocks', 'wp-dom-ready', 'wp-edit-post'),
filemtime(plugin_dir_path(__FILE__) . 'shortcode-paste-handler.js'),
true
);
}

add_action('enqueue_block_editor_assets', 'dsp_enqueue_block_editor_assets');

0 comments on commit 2b0a7e4

Please sign in to comment.