Title: contenteditable=&#8221;false&#8221;
Last modified: November 25, 2023

---

# contenteditable=”false”

 *  Resolved [jackbluehouse2019](https://wordpress.org/support/users/jackbluehouse2019/)
 * (@jackbluehouse2019)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/contenteditablefalse/)
 * Hello wp specialists,
   I am developing a plugin that creates posts programatically.
   In the content of the post there is a text that I want to protect so that it 
   cannot be modified by the author of the article. For this I use the following
   tag: `<span contenteditable="false">`But I notice that when generating the post
   this tag disappears. How can I prevent wp from removing this tag when the article
   is generated?

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [jackbluehouse2019](https://wordpress.org/support/users/jackbluehouse2019/)
 * (@jackbluehouse2019)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/contenteditablefalse/#post-17229246)
 * I added your code at the beginning of my plugin and it doesn’t work.
   This is 
   the line in my code:<strong><span contenteditable=”false”>Date du vol rando :
   </span></strong>’.$date.and this is what’s returned in the post content:<strong
   >Date du vol rando :</strong>22/11/2023
 * $allowed_protoco what is this variable?
 *  Thread Starter [jackbluehouse2019](https://wordpress.org/support/users/jackbluehouse2019/)
 * (@jackbluehouse2019)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/contenteditablefalse/#post-17229286)
 * I asked chatGPT for help and he gave me that code:
 *     ```wp-block-code
       add_filter('content_save_pre', 'my_custom_content_filter'); function my_custom_content_filter($content) { global $allowedposttags; // Ajouter votre balise à la liste des balises autorisées $allowedposttags['span']['contenteditable'] = true; // Utiliser wp_kses pour valider le contenu avec les nouvelles balises autorisées $content = wp_kses($content, $allowedposttags); return $content; }
       ```
   
 * and it works!
    -  This reply was modified 2 years, 4 months ago by [bcworkz](https://wordpress.org/support/users/bcworkz/).
      Reason: code format fixed
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/contenteditablefalse/#post-17229428)
 * Hello [@jackbluehouse2019](https://wordpress.org/support/users/jackbluehouse2019/),
 * I’m glad ChatGPT gave you a workable solution. Thanks for posting the solution,
   it might be useful to others. When you post code here in the forums in the future,
   please use the code block. When you do not, the forum’s parser corrupts the code,
   making it difficult for others to copy/paste it for their own use or to further
   help you.
 * I moved your code into a code block so it can be more useful to others. Unfortunately
   it contains no line feeds so it’s difficult to read, but at least it’ll copy/
   paste correctly. While it would have been nice to format code with line feeds
   and indents, it’s not essential.
 *  Thread Starter [jackbluehouse2019](https://wordpress.org/support/users/jackbluehouse2019/)
 * (@jackbluehouse2019)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/contenteditablefalse/#post-17229443)
 *     ```wp-block-code
       add_filter('content_save_pre', 'my_custom_content_filter');
   
       function my_custom_content_filter($content) {
           global $allowedposttags;
   
           // Ajouter votre balise à la liste des balises autorisées
           $allowedposttags['span']['contenteditable'] = true;
   
           // Utiliser wp_kses pour valider le contenu avec les nouvelles balises autorisées
           $content = wp_kses($content, $allowedposttags);
   
           return $content;
       }
       ```
   
 * Very sorry for that I won’t do it again.
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/contenteditablefalse/#post-17230764)
 * No worries at all. Thanks for taking the time to format the code and re-posting.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘contenteditable=”false”’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 5 replies
 * 3 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [2 years, 4 months ago](https://wordpress.org/support/topic/contenteditablefalse/#post-17230764)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
