<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[Forums.Likebd.Com - Sql]]></title>
		<link>http://forums.likebd.com/</link>
		<description><![CDATA[Forums.Likebd.Com - http://forums.likebd.com]]></description>
		<pubDate>Fri, 23 Oct 2026 07:12:34 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Wordpress site sql coment for easy to work]]></title>
			<link>http://forums.likebd.com/showthread.php?tid=3320</link>
			<pubDate>Wed, 04 Jul 2018 17:40:33 +0000</pubDate>
			<dc:creator><![CDATA[<a href="http://forums.likebd.com/member.php?action=profile&uid=1">Hasan</a>]]></dc:creator>
			<guid isPermaLink="false">http://forums.likebd.com/showthread.php?tid=3320</guid>
			<description><![CDATA[Remove all spam comments from the database<br />
This SQL query removes all comments marked as “spam” from the database:<br />
<br />
DELETE FROM wp_comments WHERE wp_comments.comment_approved = 'spam';<br />
<br />
Works great in all versions of WordPress including 3.0!<br />
<br />
Disabling and enabling comments<br />
In the WordPress database, the “wp_posts” table includes a column called “comment_status”, which may contain one of the following values for each row (i.e., post):<br />
<br />
open (comments open to everyone)<br />
closed (comments closed to everyone)<br />
registered_only (comments open for registered/logged-in users)<br />
Given this information, we may execute the following SQL queries (via phpMyAdmin or any other method of querying the database) to manipulate our discussion-management settings for comments:<br />
<br />
Note: Remember to backup your database!<br />
Globally enable comments for all users<br />
UPDATE wp_posts SET comment_status = 'open';<br />
Globally disable comments for all users<br />
UPDATE wp_posts SET comment_status = 'closed';<br />
Globally enable comments for registered users only<br />
UPDATE wp_posts SET comment_status = 'registered_only';<br />
Globally enable/disable comments before a certain date<br />
For this query, specify the comment_status as either open, closed, or registered_only. Also, specify the date by editing the 2008-01-01 to match whatever date you want to target.<br />
<br />
UPDATE wp_posts SET comment_status = 'closed' WHERE post_date &lt; '2008-01-01' AND post_status = 'publish';<br />
I run this query a few times each year (or as often as I can remember it) to disable comments on old posts. Ultimately, I will combine this query with a similar one (provided below) for pingbacks and trackbacks to manage discussion options with a single step.<br />
<br />
Disabling and enabling Trackbacks &amp; Pingbacks<br />
Similar as before, the “wp_posts” table also includes a column called “ping_status”, which applies to both pingbacks and trackbacks, and may contain one of the following values for each row (i.e., post):<br />
<br />
open (pingbacks/trackbacks open to everyone)<br />
closed (pingbacks/trackbacks closed to everyone)<br />
Given this information, we may execute the following SQL queries (via phpMyAdmin or any other method of querying the database) to manipulate our discussion-management settings for pingbacks and trackbacks:<br />
<br />
Globally enable pingbacks/trackbacks for all users<br />
UPDATE wp_posts SET ping_status = 'open';<br />
Globally disable pingbacks/trackbacks for all users<br />
UPDATE wp_posts SET ping_status = 'closed';<br />
Globally enable/disable pingbacks/trackbacks before a certain date<br />
For this query, specify the ping_status as either open or closed. Also, specify the date by editing the 2008-01-01 to suit your needs.<br />
<br />
UPDATE wp_posts SET ping_status = 'closed' WHERE post_date &lt; '2008-01-01' AND post_status = 'publish';<br />
As before, this last query is one that I will be using a few times each year (or as often as I can remember it) to disable comments on old posts. Ultimately, I will combine this query with the comments query to produce the one-step discussion-management query provided below.<br />
<br />
Complete, one-step discussion management<br />
Given the queries described above, we may fashion the following “one-step” SQL queries, perfect for complete, plugin-free discussion management:<br />
<br />
Globally enable/disable all discussion: comments, pingbacks and trackbacks<br />
For this query, specify the comment_status as either open, closed, or registered_only. Also, specify the ping_status as either open or closed.<br />
<br />
UPDATE wp_posts SET comment_status = 'open', ping_status = 'open' WHERE comment_status = 'closed' AND post_status = 'publish';<br />
Globally enable/disable comments, pingbacks and trackbacks before a certain date<br />
For this query, specify the comment_status as either open, closed, or registered_only. Also, specify the ping_status as either open or closed. Finally, specify the date by editing the 2008-01-01 to suit your needs.<br />
<br />
UPDATE wp_posts SET comment_status = 'closed', ping_status = 'closed' WHERE post_date &lt; '2008-01-01' AND post_status = 'publish';<br />
That last query is perfect for manual control over the closing of both comments and xbacks for posts from a specific time period. Sure there are plugins for this, but there are also plugins that enable direct SQL commands, making it convenient for granular control over discussion intervals.]]></description>
			<content:encoded><![CDATA[Remove all spam comments from the database<br />
This SQL query removes all comments marked as “spam” from the database:<br />
<br />
DELETE FROM wp_comments WHERE wp_comments.comment_approved = 'spam';<br />
<br />
Works great in all versions of WordPress including 3.0!<br />
<br />
Disabling and enabling comments<br />
In the WordPress database, the “wp_posts” table includes a column called “comment_status”, which may contain one of the following values for each row (i.e., post):<br />
<br />
open (comments open to everyone)<br />
closed (comments closed to everyone)<br />
registered_only (comments open for registered/logged-in users)<br />
Given this information, we may execute the following SQL queries (via phpMyAdmin or any other method of querying the database) to manipulate our discussion-management settings for comments:<br />
<br />
Note: Remember to backup your database!<br />
Globally enable comments for all users<br />
UPDATE wp_posts SET comment_status = 'open';<br />
Globally disable comments for all users<br />
UPDATE wp_posts SET comment_status = 'closed';<br />
Globally enable comments for registered users only<br />
UPDATE wp_posts SET comment_status = 'registered_only';<br />
Globally enable/disable comments before a certain date<br />
For this query, specify the comment_status as either open, closed, or registered_only. Also, specify the date by editing the 2008-01-01 to match whatever date you want to target.<br />
<br />
UPDATE wp_posts SET comment_status = 'closed' WHERE post_date &lt; '2008-01-01' AND post_status = 'publish';<br />
I run this query a few times each year (or as often as I can remember it) to disable comments on old posts. Ultimately, I will combine this query with a similar one (provided below) for pingbacks and trackbacks to manage discussion options with a single step.<br />
<br />
Disabling and enabling Trackbacks &amp; Pingbacks<br />
Similar as before, the “wp_posts” table also includes a column called “ping_status”, which applies to both pingbacks and trackbacks, and may contain one of the following values for each row (i.e., post):<br />
<br />
open (pingbacks/trackbacks open to everyone)<br />
closed (pingbacks/trackbacks closed to everyone)<br />
Given this information, we may execute the following SQL queries (via phpMyAdmin or any other method of querying the database) to manipulate our discussion-management settings for pingbacks and trackbacks:<br />
<br />
Globally enable pingbacks/trackbacks for all users<br />
UPDATE wp_posts SET ping_status = 'open';<br />
Globally disable pingbacks/trackbacks for all users<br />
UPDATE wp_posts SET ping_status = 'closed';<br />
Globally enable/disable pingbacks/trackbacks before a certain date<br />
For this query, specify the ping_status as either open or closed. Also, specify the date by editing the 2008-01-01 to suit your needs.<br />
<br />
UPDATE wp_posts SET ping_status = 'closed' WHERE post_date &lt; '2008-01-01' AND post_status = 'publish';<br />
As before, this last query is one that I will be using a few times each year (or as often as I can remember it) to disable comments on old posts. Ultimately, I will combine this query with the comments query to produce the one-step discussion-management query provided below.<br />
<br />
Complete, one-step discussion management<br />
Given the queries described above, we may fashion the following “one-step” SQL queries, perfect for complete, plugin-free discussion management:<br />
<br />
Globally enable/disable all discussion: comments, pingbacks and trackbacks<br />
For this query, specify the comment_status as either open, closed, or registered_only. Also, specify the ping_status as either open or closed.<br />
<br />
UPDATE wp_posts SET comment_status = 'open', ping_status = 'open' WHERE comment_status = 'closed' AND post_status = 'publish';<br />
Globally enable/disable comments, pingbacks and trackbacks before a certain date<br />
For this query, specify the comment_status as either open, closed, or registered_only. Also, specify the ping_status as either open or closed. Finally, specify the date by editing the 2008-01-01 to suit your needs.<br />
<br />
UPDATE wp_posts SET comment_status = 'closed', ping_status = 'closed' WHERE post_date &lt; '2008-01-01' AND post_status = 'publish';<br />
That last query is perfect for manual control over the closing of both comments and xbacks for posts from a specific time period. Sure there are plugins for this, but there are also plugins that enable direct SQL commands, making it convenient for granular control over discussion intervals.]]></content:encoded>
		</item>
	</channel>
</rss>