3

Though this is not a programming related question but I am facing a bitter experience with this WordPress problem. the problem is HTML Tags are not working in my website. See the images

This is text Part

This is Visual part

This is how it publish

3
  • Possibly the theme doesn't allow HTML and strips it out using functions like e.g. esc_html or wp_kses
    – kraftner
    Commented Feb 27, 2017 at 13:40
  • How to make sure that?
    – Kallol Das
    Commented Feb 27, 2017 at 13:53
  • Yes, We can add .html into wordpress Page and post. i am already use this plugin. Check Code Here : wordpress html url free plugin Commented Jul 6, 2018 at 2:57

1 Answer 1

0

It's not the theme that's how TinyMCE editor works. If you remain on the "Text" tab and update the post then the html will remain untouched and display properly on the front-end. However if you switch back to the "visual editor" it will break.

Here, you can use this on your functions.php

    // Modify Tiny_MCE init
add_filter('tiny_mce_before_init', 'smartenTinyMCE' );
function smartenTinyMCE($init) {
    // Add PRE and CODE to the block formats menu
    $init['theme_advanced_blockformats'] = 'h2,h3,h4,h5,h6,p,blockquote,pre,code';

    // Allow extra attributes for some syntax highlighters, IE: <pre lang="php" line="5">...</pre)
    // Allow iFrames for live examples
    $init['extended_valid_elements'] = 'pre[*]';

    return $init;
}

Source: https://provideyourown.com/2011/how-to-insert-code-into-your-wordpress-blog/

PS: You can add more separated by comma example:

$init['extended_valid_elements'] = 'pre[*],code[*],iframe[*]';
4
  • 1
    Its getting worse now. Visual part is showing nothing :-( Nor in Front End.
    – Kallol Das
    Commented Feb 27, 2017 at 19:34
  • Please switch to the updated code i tested on live site it's working. Commented Feb 27, 2017 at 20:35
  • Its not working till now. I am also working on a Live site. dccss.org/…
    – Kallol Das
    Commented Mar 1, 2017 at 3:49
  • I'm not sure why that happens. Sorry, maybe someone else knows best. Commented Mar 2, 2017 at 0:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.