Unable to disable Autop
-
Genius in theory but realistic only for content editors and beginners. HTML written in Gutenberg will be mashed up with <p> elements in the output. Please stop manipulating the output. If tags don’t populate in the visual editor, then they shouldn’t appear “out of the blue” when published.
-
The thing is, WordPress has never had a real way to “disable auto-p” out of the box, and even the token options for reducing formatting in the Settings->Writing screen have been disappearing over time.
WordPress, as a whole, has been moving away from use-your-own-HTML and towards a more integrated and simpler writing experience for many years now. So, this sort of thing isn’t new.
By and large, if you want to keep writing your own HTML, then plugins to disable these writing methods are going to be the way to go. If you want nothing more than a textbox where you type in raw HTML, then you’re going to need a plugin to do it in the future, because WordPress simply isn’t going to offer that sort of thing anymore. The idea that you need to know HTML to publish to a webpage is fundamentally not going to be a supported option, or even a widely held opinion.
The Classic Editor plugin exists for the case where people want the more basic and raw experience, and that’s pretty much the way that it’s going to be for the future. Whether you like blocks or not, raw text input fields are not going to be a core supported option.
Thanks for your reply Otto. There must be some concerns for backward compatibility in the new Gutenberg? If I install Gutenberg now, all past posts and pages where autop was turned off now have <p> littering the code. So, the workaround, as you have suggested is to proactively install the Classic Editor? That’s a low blow to everyone that customized code and depends on future versions of WordPress to maintain some consistency in handling HTML in posts and pages. Customization is what has helped WordPress become so powerful. Having a toggle to disable autop in Gutenberg would certainly smooth the transition.
Gutenberg will not pro-actively alter your posts from the past, unless you go to Edit them with the new editor and have it convert them in the process.
The content remains the same, in your post_content field in the database. It has not really changed, and installing a new editor won’t change it either.
Also, there is no “toggle” for auto-p handling in WordPress. If you have such a toggle, then you have something else adding it. WordPress does not have an option to disable auto-p now, or in the future.
Hey Otto, I think that’s exactly where the disconnect is…
I’m using remove_filter(‘the_content’,’wpautop’); and Gutenberg does not honor this. So the content is displayed differently the instant Gutenberg is installed, regardless if the post is edited.
Gutenberg is not backward compatible in this way.
Yeah, so, that has never really been enough to change how the editor works, unless you have also never really used the TinyMCE editor at all.
The core wpautop filter is a very basic version of the filter, and it was only ever used on the output side of things. But the JS editor, TinyMCE, has always done its own formatting, and unless you rigidly stuck to the non-Visual view of things, then your content has always been “messed with”, for ages and ages now.
So, yeah, if you’re using a Visual editor of any sort, then yes, WordPress is going to try to “fix” your content. Most people don’t know HTML. Most people don’t want or need to know it. So, it’s not geared towards you, who want your post content to exist as-you-put-it-in. Most people want a WYSIWYG editing experience.
If you want something other than that, you’re going to need to start rethinking things, and use plugins to provide something that is closer to the base HTML that is generated. WordPress is not catering to your needs. Sorry, it’s just not the majority, by a long shot.
The Classic Editor plugin will work for you in the short term. It will eliminate Gutenberg and keep the editor as-it-is-now. But in the long term, if you have this need to micromanage your HTML code, then you may need to find alternatives.
Hi Otto,
As you have suggested, I downloaded and tested the classic editor plugin. As expected, it’s the traditional interface and the content is unchanged on the admin side.
However, Gutenberg continues to modify the content on the front end, regardless if the classic editor is installed, and regardless if remove_filter(‘the_content’,’wpautop’); is present. Gutenberg is adding <p> and <br> elements inside <style> and <script> tags. Backward compatibility for Gutenberg for turning off wpautop is not even an afterthought, it’s completely lacking.
I appreciate your thoughts but I stand by the one star rating until there is more consideration for backward compatibility.
Hello, you may have a look at ClassicPress, a fork of WP that desactivate completely Gutenberg.
Hello Rermis, did you find a solution to this inability to disable autop?
Those unwanted P tags are really causing some editing problems here.@o2xav Yes, it looks like there’s a block type named “Custom HTML” in Gutenberg. Using this block type appears to be a successful way to avoid autop, and the code is not manipulated on preview. Worth experimenting at the least.
Well in fact i disabled gutenberg, and i am using the classic editor.
Still, since the 5.0 update, disable autop does not work anymore.Please how can I use the custom block to add HTML code to map makers?
- The topic ‘Unable to disable Autop’ is closed to new replies.