Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter toyomedia

    (@toyomedia)

    I got temporary solution..
    In /wp-content/wp-includes/kses.php file, I added

    'iframe' => array(
    	'title' => true,
    	'line' => true,
    	'width' => true,
    	'height' => true,
    	'frameborder' => true,
    	'src' => true,
    	'webkitallowfullscreen' => true,
    	'mozallowfullscreen' => true,
    	'allowfullscreen' => true,
    			),

    Is there any way put this function in theme’s function.php instead of doing this in wp core file?

    You can find such code snippets / tutorials on allowing more tags with in a specific area or site-wide usage by adding some hooks to your theme’s functions.php .

    /* You can add other HTML tags (and attributes) to your allowed html tags list
    
    function my_allowed_html_tags() {
      define('CUSTOM_TAGS', true);
      global $allowedtags;
    
      $allowedtags = array(
          'a' => array(
               'href' => array (),
               'title' => array ()),
          'blockquote' => array(
          'cite' => array ()),
          'cite' => array (),
          'code' => array(),
          'em' => array(),
          'strong' => array(),
          // <p> and <pre> were not allowed by default in kses.php file; so here we add them.
          'pre' => array(),
          'p' => array()
          // and here is the <iframe> tag you mentioned
          'iframe' => array(
    	'title' => true,
    	'line' => true,
    	'width' => true,
    	'height' => true,
    	'frameborder' => true,
    	'src' => true,
    	'webkitallowfullscreen' => true,
    	'mozallowfullscreen' => true,
    	'allowfullscreen' => true,
    			),
      );
    }
    //Hook this new function to the specific action (init).
    add_action('init', 'my_allowed_html_tags', 10);
    Thread Starter toyomedia

    (@toyomedia)

    Thanks for replying, ManusH.
    Unfortunately, it didn’t work for me.

    I also tried

    function my_allowed_html_tags() {
      define('CUSTOM_TAGS', true);
      global $allowedtags;
    
      $allowedtags = array(
          'pre' => array(),
          'p' => array(),
          'iframe' => array(
    	'title' => array(),
    	'line' => array(),
    	'width' => array(),
    	'height' => array(),
    	'frameborder' => array(),
    	'src' => array(),
    	'webkitallowfullscreen' => array(),
    	'mozallowfullscreen' => array(),
    	'allowfullscreen' => array(),
    			),
      );
    }
    
    add_action('init', 'my_allowed_html_tags', 10);

    and instead of ‘init’, tried ‘comment_content’ and ‘comment_post’ and ‘$note’.
    But shouldn’t ‘init’ be working everywhere?
    Anyway, none of them worked..

    This is the line that makes customer note work, I guess.
    woocommerce/includes/admin/meta-box/class-wc-meta-box-order-notes.php

    <?php echo wpautop( wptexturize( wp_kses_post( $note->comment_content ) ) ); ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘I want to allow html tags on customer note in view-order page’ is closed to new replies.