C
C
chelnokov_a2020-06-23 18:11:27
WordPress
chelnokov_a, 2020-06-23 18:11:27

How to disable automatic page editing in WP?

Hello. The bottom line is this: I have a record where I insert the layout in the code editing mode. After switching to the visual editor, WP itself adds closing tags to the code. How to remove it?

this did not help
remove_filter('the_content','wptexturize'); // Disable auto-formatting in full post
remove_filter('the_excerpt','wptexturize'); // Disable auto-formatting in the short(announcement) post
remove_filter('comment_text', 'wptexturize'); // Disable auto-formatting in

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Ermilov, 2020-06-24
@sergeiermilov

You can get rid of adding a p-tag with the following snippet in the functions.php of the theme:

function disable_wp_auto_p( $content ) {
  remove_filter( 'the_content', 'wpautop' );
  remove_filter( 'the_excerpt', 'wpautop' );
  return $content;
}
add_filter( 'the_content', 'disable_wp_auto_p', 0 );

But I suspect that in your case it is best to do it through shortcode plugins. There is a convenient Shortcoder :
1. Create a shortcode through the plugin,
2. Add the required code through the "code editor" in the plugin,
3. Paste it in the place in the article or on the page where the code should be displayed.
That's it, layout in its purest form without unnecessary tags. You can embed JS, CSS, HTML.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question