Skip to content

Instantly share code, notes, and snippets.

View valentin-grenier's full-sized avatar
🏠
Working from home

Valentin Grenier valentin-grenier

🏠
Working from home
View GitHub Profile
@valentin-grenier
valentin-grenier / block-editor-validation.js
Last active November 13, 2024 20:57
Simple script to validate post data before saving it.
/*
* Code authored by Valentin Grenier - Studio Val
* Freelance WordPress Developer from Toulouse, France
* https://studio-val.fr/
*/
let isNoticeDisplayed = false;
const POST_TYPE = 'your-post-type';
wp.data.subscribe(() => {
@valentin-grenier
valentin-grenier / disable-wordpress-comments.php
Last active October 10, 2024 14:30
Completely disable WordPress comments
/**
* Code authored by Valentin Grenier - Studio Val
* Freelance WordPress Developer from Toulouse, France
* https://studio-val.fr
*
* Completely disable WordPress comments
* 1. Removes from admin menu
* 2. Removes from post and pages
* 3. Removes from admin bar
* 4. Prevents comments from being stored in the database