i have a wordpess site and my users should be able to post code snippets into their comments(like here in css-tricks). i am the site administrator so i dont have a problem with showing codes and using pre tags but when i comment to a post as a guest user i can not see code with styling! by using chrome tools for developers i can see my codes surrendered with code tag but i wrote pre tag like what i did as i was admin! so what is the problem?!
You ought not to be modifying anything outside of wp-content anyway as this is core and so your changes will get overwritten when WordPress updates. To avoid, you should define a custom function in your theme to alter the default set of tags that are allowed. See this tutorial for more information.
i have a wordpess site and my users should be able to post code snippets into their comments(like here in css-tricks). i am the site administrator so i dont have a problem with showing codes and using pre tags but when i comment to a post as a guest user i can not see code with styling! by using chrome tools for developers i can see my codes surrendered with code tag but i wrote pre tag like what i did as i was admin! so what is the problem?!
i have found kses.php in wp-include but it has all allowed html tags not just for guest user!
You ought not to be modifying anything outside of
wp-contentanyway as this is core and so your changes will get overwritten when WordPress updates. To avoid, you should define a custom function in your theme to alter the default set of tags that are allowed. See this tutorial for more information.@mostafaghanbari ,
If you want to try something client side, you can escape the characters they enter. Im sure there is a php (more secure) alternative.
http://codepen.io/johnmotyljr/pen/Frcth