[wp-trac] [WordPress Trac] #27111: Turning off global comments should include existing content
WordPress Trac
noreply at wordpress.org
Wed May 20 20:36:57 UTC 2015
#27111: Turning off global comments should include existing content
-------------------------+-----------------------------
Reporter: jenmylo | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Comments | Version: 3.9
Severity: normal | Resolution:
Keywords: has-patch | Focuses: administration
-------------------------+-----------------------------
Comment (by Stagger Lee):
Math Captcha has functions.php snippet for this .htaccess code. I could
not see it is for overwriting own code inside .htaccess.
Is it possible to use .htaccess code inside functions.php ? How it goes
with priority ?
I am asking because it would be nice to use this snippet in functions.php.
Hate when .htaccess gets overwritten when you click Save in permalinks
options.
This is code from Math Captcha:
{{{
public function block_direct_comments($rules)
{
if(Math_Captcha()->options['general']['block_direct_comments'])
{
$new_rules =
<<<EOT
\n# BEGIN Math Captcha
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post.php*
RewriteCond %{HTTP_REFERER} !.*{$_SERVER['HTTP_HOST']}.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
</IfModule>
# END Math Captcha\n\n
EOT;
return $new_rules.$rules;
}
return $rules;
}
}}}
More here:
[https://github.com/tamagokun/pomander-
wordpress/blob/master/lib/generators/htaccess.php]
[https://github.com/artzstudio/hoshinbudo.com/blob/master/wp-
content/plugins/w3-total-cache/lib/W3/SharedRules.php]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27111#comment:28>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list