0

My webstie have custom post type created, and now I want to disable usage of any html tag in content editor, so only plain text is saved in database (and to remove content editor and html editor if possible).

I found functions to remove (rich) content editor:

add_filter('user_can_richedit' , create_function('' , 'return false;') , 50);

And HTML editor remained. But even if I maange to remove HTML editor (this: http://prntscr.com/26uj6u ), users will be able to just type html tags and they will be saved in database.

Can someone help me with this?

2
  • Have you tried any solutions (i.e. using save_post hook) already? What was wrong with them? Nov 26 '13 at 21:41
  • Nope, didn't tried that. How?
    – SomeoneS
    Nov 27 '13 at 20:33
-1

You can restrict the use of tags with Java-script. Before the comment being saved to the database you can trigger an on change event and check the comment text( which is basically a string) for keywords like html using functions like indexOf. Based on the result of the check you can then force the user to comment without using html.

Need help with the code? If not, please share your final solution.

2
  • I didn't mentioned comments anywhere, my question was regarding post content.
    – SomeoneS
    Nov 27 '13 at 20:34
  • Using JavaScript to restrict anything is a bad idea - user can simply disable JS and do whatever he wants. Nov 28 '13 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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