• Hello,

    when I add a custom tags like <my tag> in “Text” mode and then switch to “Visual”, the custom tags is removed. how can I prevent it?

    Thanks
    Nexus

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter nexusfred

    (@nexusfred)

    I found a PHP solution:

    https://gist.github.com/BronsonQuick/3615651

    <?php
    /*
     * Our client needed some data sent in XML tags from Gravity Forms notifications to their system. These tags were being stripped by
     * TinyMCE when the client would switch from HTML to Visual. This was my fix for it.
     * 
     */
    
    function sennza_add_custom_tinymce_tags( $init ) {
        // Command separated string of extended elements
        $ext = 'mytag1,mytag2';
    
        // Add to extended_valid_elements if it alreay exists
        if ( isset( $init['extended_valid_elements'] ) ) {
            $init['extended_valid_elements'] .= ',' . $ext;
        } else {
            $init['extended_valid_elements'] = $ext;
        }
    
        // Super important: return $init!
        return $init;
    }
    
    add_filter('tiny_mce_before_init', 'sennza_add_custom_tinymce_tags');
    
    Thread Starter nexusfred

    (@nexusfred)

    The PHP solution half work because TinyMCE still removing class from the custom tag ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Stop removing custom tag’ is closed to new replies.