<?php 
/**
 * Plugin Name: SEO
 * Plugin URI: https://btobdesign.com
 * Description: Optimisation des permaliens
 * Version: 1.0
 * Author: B-to-B Design
 * Author URI: https:///btobdesign.com
 *
 */


// optimisation du permalien
add_filter('sanitize_title', 'remove_false_words');
function remove_false_words($slug) {
    if (!is_admin()) return $slug;
    $slug = explode('-', $slug);
    foreach ($slug as $k => $word) {
		$keys_false = 'the,a,an,on,in,out,from,un,une,des,du,le,la,les,nos,vos,leur,son,ce,cette,ces,avec,qui,que,sont,est,ont,sur';
		$keys = explode(',', $keys_false);
		foreach ($keys as $l => $wordfalse) {
			if ($word==$wordfalse) {
				unset($slug[$k]);
			}
		}
    }
    return implode('-', $slug);
}