web analytics
Skip to content

[WordPress] Remove keywords from KeywordLuv comments

wordpress logo square - [WordPress] Remove keywords from KeywordLuv comments

WordPress is a very popular tool for building a website, almost one in 6 sites in the world is designed with this CMS. It is so popular that it makes SEOs wanting to get a link in the comments of the articles easily. Links to improve the SEO of a website on Google.

WordPress logo

This popularity with SEOs, pushes many Internet users to post comments with the name “Name @ Keyword” to respect the format used by the KeywordLuv plugin. Admittedly, it doesn’t look like a real username. This article will present an SQL query to remove the keywords from names and thus avoid ending up with names such as: “Paul @ serrurier Paris”, “Maurice @ mutual health”, “Sophie @ coque iPhone”…

SQL queries

It is therefore possible to automatically delete the keywords contained in the name of the commentator by using the following SQL query:

UPDATE `wp_comments`
SET `comment_author` = SUBSTRING(`comment_author`, 1, LOCATE("@", `comment_author`) - 1)
WHERE `comment_author` LIKE "%@%"

This SQL query uses the LOCATE () and SUBSTRING () functions. Depending on your Database Management System (DBMS), the query may be adapted (because some DBMS use for example the SUBSTR () or INSTR () function).

Source: blog.axe-net.fr.

Last word

It is possible to automate the execution of this request by placing it in a CRON request. This makes it possible to accept comments automatically, without accepting optimized links from the people who write them.

This content was published in WordPress.