Web Hosting
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Reply To: Text editor changing HTML markup

Discussion in 'Misc WordPress Requests' started by HudsonValleyWebDesign, Dec 5, 2017.

  1. HudsonValleyWebDesign

    Guest

    Reply To: Text editor changing HTML markup, by HudsonValleyWebDesign

    I have added a function to my theme to help with TinyMCE problems with code:


    /**
    * Add to extended_valid_elements for TinyMCE
    *
    * @param $init assoc. array of TinyMCE options
    * @return $init the changed assoc. array
    */
    function my_change_mce_options( $init ) {
    // Command separated string of extended elements
    $ext = 'pre[id|name|class|style]';

    // 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', 'my_change_mce_options');

    Reply To: Text editor changing HTML markup
     
    #1

Share This Page

Web Hosting