EFFACER L’HISTORIQUE DES RÉVISIONS D’ARTICLES ET DE PAGES
DELETE FROM `wp_posts` WHERE `post_type` = 'revision'
RECHERCHER LES ARTICLES D’UNE CATÉGORIE DONNÉE
Cette requête liste les articles présents dans une catégorie déterminée par NomCatégorie.
SELECT post_title FROM wp_posts p JOIN wp_term_relationships r ON r.object_id = p.ID JOIN wp_term_taxonomy t ON r.term_taxonomy_id = t.term_taxonomy_id JOIN wp_terms terms ON terms.term_id = t.term_id WHERE t.taxonomy ='category' AND terms.name = 'NomCatégorie' AND p.post_type = 'post';
MODIFIER LE STATUT DE PUBLICATION DE VOS ARTICLES D’UNE CATÉGORIE DONNÉE
remplacez le mot-clé NomCatégorie par la catégorie concernée et indiquez le statut de publication de votre choix dans SET p.post_status = ‘publish’ ; soit publish, pending ou draft.
UPDATE wp_posts p JOIN wp_term_relationships r ON r.object_id = p.ID JOIN wp_term_taxonomy t ON r.term_taxonomy_id = t.term_taxonomy_id JOIN wp_terms terms ON terms.term_id = t.term_id SET p.post_status = 'publish' WHERE t.taxonomy ='category' AND terms.name = 'NomCatégorie' AND p.post_type = 'post';
TOP 10 DES ARTICLES LES PLUS COMMENTÉS EN 2010
affiche la liste des 10 articles ayant reçu le plus de commentaires en 2010
SELECT post_title,comment_count FROM wp_posts WHERE post_status="publish" AND year(post_date) = 2010 ORDER BY comment_count DESC LIMIT 0,10;
NOMBRE D’ARTICLES PUBLIÉS EN 2010
retournera le nombre d’articles parus au cours de l’intervalle de temps défini
SELECT COUNT(*) FROM wp_posts WHERE post_status="publish" AND year(post_date) = 2010;
CHANGER L’URL DU SITE ET L’URL D’INSTALLATION (SITEURL ET HOMEURL) + GUID + URLS DE CONTENU + CHEMIN DES IMAGES SEULEMENT + DOUMENTS JOINTS + META DES ARTICLES
WordPress stocke le chemin absolu de l’URL de votre site et de l’accueil dans la base de données. Si vous transférez celui-ci d’un serveur local vers un hébergement en ligne, votre site ne fonctionnera car les URLs d’installation pointeront vers les dossiers locaux. Cette requête est donc là pour résoudre ce problème.
UPDATE wp_options SET option_value = replace(option_value, 'http://www.vieuxsite.fr', 'http://www.nouveausite.fr') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = REPLACE (guid, 'http://www.vieuxsite.fr', 'http://www.nouveausite.fr');
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://www.vieuxsite.fr', 'http://www.nouveausite.fr');
UPDATE wp_posts SET post_content = REPLACE (post_content, 'src="https://www.vieuxsite.fr', 'src="https://amazon.nouveausite.fr');
UPDATE wp_posts SET guid = REPLACE (guid, 'http://www.vieuxsite.fr', 'http://amazon.nouveausite.fr') WHERE post_type = 'attachment';
MODIFIER LE COMPTE UTILISATEUR ADMIN + REMETTRE À ZÉRO LE MOT DE PASSE
UPDATE wp_users SET user_login = 'Nouveau pseudo' WHERE user_login = 'Admin';
UPDATE wp_users SET user_pass = MD5( 'nouveau_mot_de_passe' ) WHERE user_login = 'votre_pseudo';