Skip to content

Instantly share code, notes, and snippets.

Avatar
🇨🇦
Made in Canada

Hunter WebDev Hunter-WebDev

🇨🇦
Made in Canada
View GitHub Profile
@Hunter-WebDev
Hunter-WebDev / disable-wp-fatal-error-handler-alt.php
Last active Jul 13, 2020
Disable WordPress Fatal Error Handler Message From The Theme functions.php
View disable-wp-fatal-error-handler-alt.php
add_filter( 'wp_fatal_error_handler_enabled', '__return_false' );
@Hunter-WebDev
Hunter-WebDev / disable-wp-fatal-error-handler.php
Last active Jul 13, 2020
Disable WordPress Fatal Error Handler Message
View disable-wp-fatal-error-handler.php
define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true );
@Hunter-WebDev
Hunter-WebDev / grab-post-meta.php
Created Sep 3, 2019
Get post meta shortcode in WordPress
View grab-post-meta.php
<?php
/**
* Returns post meta
*
* Usage:
* [grab_post_meta id="15" key="meta_key"]
* [grab_post_meta key="meta_key"]
*
* For more information on how to use this shortcode view: https://hunterwebdev.io/blog/create-a-custom-shortcode-to-grab-post-meta
*/
@Hunter-WebDev
Hunter-WebDev / generate-cf7-mail-tags.js
Last active Aug 29, 2019
Used to generate the mail tags into the message body, blog post explaining how to use this gist: https://hunterwebdev.io/blog/quickly-add-all-contact-form-7-tags-when-creating-form/
View generate-cf7-mail-tags.js
var $ = jQuery;
var copy = "\n\n";
var i = 0;
$('#wpcf7-mail .mailtag.code.unused').each(function(){
var text = $(this).text();
var key = text.replace(/\[|]/g, '');
copy += key.replace(/\-|_/g, ' ').toLowerCase().replace(/\b[a-z]/g, function(letter) {
return letter.toUpperCase();
@Hunter-WebDev
Hunter-WebDev / .htaccess
Created Dec 30, 2017
Leverage browser caching
View .htaccess
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
@Hunter-WebDev
Hunter-WebDev / delete-orphaned-meta.sql
Created Oct 19, 2017
Delete orphaned post meta within WordPress
View delete-orphaned-meta.sql
DELETE pm FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL