Skip to content

Instantly share code, notes, and snippets.

@jennimckinnon
jennimckinnon / .htaccess
Last active July 19, 2016 05:11
Block all trackbacks and pingbacks (and XML-RPC) from WordPress.
# BEGIN Block all trackbacks, pingbacks and use of XML-RPC
<FilesMatch "^(xmlrpc\.php|wp-trackback\.php)">
Order Deny,Allow
Deny from all
</FilesMatch>
# END Block all trackbacks, pingbacks and use of XML-RPC
@jennimckinnon
jennimckinnon / functions.php
Created July 19, 2016 05:03
Removing the URL field in WordPress native comments by adding this code to your theme's functions PHP file.
add_filter('comment_form_default_fields', 'unset_url_field');
function unset_url_field($fields){if(isset($fields['url']))unset($fields['url']);
return $fields;
}
certbot revoke -d your-site.com -d your-site.net
certbot certonly --webroot -w /var/www/example/ -d www.example.com -d example.com -w /var/www/other -d other.example.net -d another.other.example.net
certbot certonly --standalone -w /var/www/example/ -d www.example.com -d example.com -w /var/www/other -d other.example.net -d another.other.example.net
@jennimckinnon
jennimckinnon / wp-config.php
Created May 24, 2016 03:04
Turn on debugging and logging and turning off reporting in WordPress. From: https://premium.wpmudev.org/blog/debugging-wordpress-how-to-use-wp_debug/
// Turn debugging on
define('WP_DEBUG', true);
// Tell WordPress to log everything to /wp-content/debug.log
define('WP_DEBUG_LOG', true);
// Turn off the display of error messages on your site
define('WP_DEBUG_DISPLAY', false);
// For good measure, you can also add the follow code, which will hide errors from being displayed on-screen
http://your-site.com/wp-admin/maint/repair.php
define( 'WP_ALLOW_REPAIR', true );
<?php
$link = mysql_connect('your_hostname', 'database_username', 'database_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
UPDATE wp_options SET option_value='http://your-site.com' WHERE option_name='siteurl'