-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create disable-shortcode-pasting.php
- Loading branch information
1 parent
ee218ef
commit 2b0a7e4
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |