As you already know, WordPress manipulates posts, even if you write everything in Text mode. (replacing line breaks with rn
‘s , converting single quotes into double quotes etc.)
I know this is good for helping us not to mess things up, however, in my case, I want to put HTML codes inside my post -both <code>
and </code>
tags , and some HTML directly-.
so I want to make sure what I see in Text mode (or install an HTML mode somehow) , so that What I See is What I Get, in terms of HTML 🙂
Maybe a better explanation for what I want is this :
What I write in “add new post” window should be exactly equal to what is printed between <div class='entry-content'>
and </div>
.
Any tips for this?
Should I change my theme? Or a plugin for tinymce?
p.s.:
I know single quotes should be escaped for database, but I want to preserve line breaks, html tags etc. So please tell me there is a way other than writing directly into the database.
I have decided that the best solution is to just disable the visual editor,
from Users -> Your Profile -> Disable visual editor when writing.
get_user_meta()
is a wrapper forget_metadata()
. In case this gets triggered to question if a user can use the Rich Editor, you can disable it with that call.Another option might be to use the
WP_Role#has_cap
check (in case it’s used there). It has a filter as well:'role_has_cap'
IIRC this is the user meta/caps filter:
If you want to globally disable it for all post types, you can use the following shortcut: