To remove the <p> tags automatically added by CKEditor, you can customize the configuration of CKEditor by disabling the auto-adding of <p> tags. Here's an example of how you can achieve this:
Locate the CKEditor configuration file: Find the file where CKEditor is being configured in your project. Typically, it is located in the config.js file within the CKEditor directory.
Edit the CKEditor configuration: Inside the config.js file, add the following configuration option to disable the automatic addition of <p> tags:
CKEDITOR.editorConfig = function( config ) {
config.autoParagraph = false;
};
The config.autoParagraph = false; option instructs CKEditor to not automatically add <p> tags around text blocks.
Save the configuration file: Save the config.js file after making the changes.
Clear the cache and refresh: If you have caching enabled, clear the cache to ensure that the changes take effect. Then, refresh the page where CKEditor is being used.
By setting config.autoParagraph = false; in the CKEditor configuration, you instruct CKEditor not to insert <p> tags automatically. Instead, line breaks or other appropriate markup will be used to separate blocks of text.