Allow HTML tags in Post for All Users
-
How to allow all users to use HTML codes, because at the moment, only keymaster can have access to all HTML tags.
I would like to allow user to use this code:
//<span style=”font-size: 36pt; font-family: impact, chicago;”>Pademelon</span><span style=”font-size: 36pt; font-family: impact, chicago;”>Pademelon</span>
-
Grab this custom plugin from here https://gist.github.com/ntwb/7797990
You will need to change one part of it though:
From:
// Span 'span' => array( 'class' => true, ),
To:
// Span 'span' => array( 'class' => true, 'style' => true, ),
That will then modify the allowed tag
span
to also includestyle
inside the span.thanks, where should I put the
ntwb_bbpress_custom_kses_allowed_tags.php
in?Click the ‘download gist’ link, it will download a zip archive, unzip it and use FTP to upload the plugin to your WordPress plugins folder, typically
/wp-cntent/plugins
Edit: Or go to ‘Plugins’ -> ‘Add new’ -> ‘Upload’ and you can then upload it directly.
THANKS VERY MUCH!!!!!!!!!!!!!!!!!
I HAVE BEEN FINDING SOLUTION FOR A LONG TIME!!!! THANKS!!!!!! ๐how can I allow:
<p style=โtext-align: right;โ>gh</p> <p style=โtext-align: right;โ>hg</p> <hr />
<p style=โtext-align: left;โ>d</p>You shouldn’t really be letting users add styles, you should have your theme do that, that said., just add a new section for the
p
tag andstyle
withinp
like so:// Paragraph 'p' => array( 'style' => true, ),
thank you
sorry, can you also teach me how to allow:
<address>fff</address>
<h1>fff</h1>
<h2>ffff</h2>
<h3>ffff</h3>
<h4>ffff</h4>
<h5>ffff</h5>
<h6>ffff</h6>
thanks ๐thanks, i followed your method and added:
‘h1’ => array(),
‘h2’ => array(),
‘h3’ => array(),
‘h4’ => array(),
‘h5’ => array(),
‘h6’ => array(),
‘address’ => array(),it worked ๐
it’s really an old topic but thank you so much and it’s really helped me about H1 H2…H6
thank you so much guysWhat should I do if I do not want to allow div?
// Div 'div' => array( 'class' => false, 'style' => false, ),
This is not it, right?
Thanks for posting this. I installed the plugin, and added
// Paragraph 'p' => array( 'class' => true, 'style' => true,
But sadly I still get this in cleartext:
<p style=โtext-align: center;โ>Test 3</p>Any suggestions? Thanks!
I actually found a solution by trying some stuff out.
Go to this file: …/wp-content/plugins/bbpress/includes/common/formatting.php
And at the bottom of that file, add this:
add_filter( 'bbp_kses_allowed_tags', 'ntwb_bbpress_custom_kses_allowed_tags' ); function ntwb_bbpress_custom_kses_allowed_tags() { return array( // Links 'a' => array( 'class' => true, 'href' => true, 'title' => true, 'rel' => true, 'class' => true, 'target' => true, ), // Quotes 'blockquote' => array( 'cite' => true, ), // Div 'div' => array( 'class' => true, ), // Span 'span' => array( 'class' => true, 'style' => true, ), // Paragraph 'p' => array( 'class' => true, 'style' => true, ), // Code 'code' => array(), 'pre' => array( 'class' => true, ), // Formatting 'em' => array(), 'strong' => array(), 'del' => array( 'datetime' => true, ), // Lists 'ul' => array(), 'ol' => array( 'start' => true, ), 'li' => array(), // Images 'img' => array( 'class' => true, 'src' => true, 'border' => true, 'alt' => true, 'height' => true, 'width' => true, ), // Tables 'table' => array( 'align' => true, 'bgcolor' => true, 'border' => true, ), 'tbody' => array( 'align' => true, 'valign' => true, ), 'td' => array( 'align' => true, 'valign' => true, ), 'tfoot' => array( 'align' => true, 'valign' => true, ), 'th' => array( 'align' => true, 'valign' => true, ), 'thead' => array( 'align' => true, 'valign' => true, ), 'tr' => array( 'align' => true, 'valign' => true, ) ); }
- You must be logged in to reply to this topic.