tema function a yapıştır
function custom_editor_script() {
?>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function () {
if (typeof wp !== 'undefined' && typeof wp.data !== 'undefined') {
wp.data.subscribe(function () {
const blocks = wp.data.select('core/block-editor').getBlocks();
blocks.forEach(block => {
if (block.name === 'core/footnote') {
let newContent = `[${block.attributes.content}]`;
if (block.attributes.content !== newContent) {
wp.data.dispatch('core/block-editor').updateBlockAttributes(block.clientId, {
content: newContent
});
}
}
});
});
}
});
</script>
<?php
}
add_action('admin_footer', 'custom_editor_script');