Skip to content

Instantly share code, notes, and snippets.

Ben Huson benhuson

  • United Kingdom
Block or report user

Report or block benhuson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
benhuson / X-Poedit-KeywordsList
Last active Jun 6, 2019
WordPress Plugin Language .pot X-Poedit-KeywordsList
View X-Poedit-KeywordsList
benhuson / .htaccess
Created May 22, 2019
.htaccess block IP behind load balancer
View .htaccess
Order Deny,Allow
Deny from all
SetEnvIf X-Forwarded-For "^1\.1\.1\.1" AllowAccess
Allow from env=AllowAccess
benhuson / .htaccess
Created Sep 14, 2016
Disable HTTP Strict Transport Security (HSTS) in .htaccess
View .htaccess
<IfModule mod_headers.c>
Header set Strict-Transport-Security "max-age=0; includeSubDomains; preload" env=HTTPS
benhuson / all-category-post-permalink.php
Last active May 20, 2016
All Category Post Permalink
View all-category-post-permalink.php
* All Category Post Permalink
* When using %category% in permalinks, this allows you to substitute
* an alternative slug "all" to replace the category. By default this
* is not permitted - the post page is force redirected to a URL
* with a valid category.
View WordPress Site .gitignore
# WordPress Project .gitignore
# Ignore system files
# Ignore all files by default except `.gitignore` and `site` folder
benhuson / remove_posts_page_admin_notice.php
Created Nov 17, 2015
Remove WordPress Posts Page Admin Notice
View remove_posts_page_admin_notice.php
* Remove Posts Page Admin Notice
* Since WordPress 4.2, if you edit the page used as the Posts page
* and there was no content saved for that page, the editor functionality
* is removed and a message displayed instead.
* The following function re-enables the editor on this page.
View taxonomy-images.patch
Index: trunk/taxonomy-images.php
--- trunk/taxonomy-images.php (revision 752123)
+++ trunk/taxonomy-images.php (working copy)
@@ -798,10 +798,13 @@
$term = get_term( $term_id, $taxonomy->name );
+ $nonce = wp_create_nonce( 'taxonomy-image-plugin-create-association' );
+ $nonce_remove = wp_create_nonce( 'taxonomy-image-plugin-remove-association' );
View google-tag-manager.patch
Index: trunk/google-tag-manager.php
--- trunk/google-tag-manager.php (revision 1182053)
+++ trunk/google-tag-manager.php (working copy)
@@ -11,6 +11,8 @@
class google_tag_manager {
+ public static $output_once = false;
benhuson / intelligent-post-terms.php
Created Sep 3, 2015
Intelligent Post Terms - use most appropriate category for WordPress post links.
View intelligent-post-terms.php
* Intelligent Post Terms
* If the post category is included in the permalink for posts
* we can be clever and detect when a post is displayed or linked to
* which is the most suitable category to use in the URL.
* @version 1.0
benhuson / manage-orphan-menu-items.php
Created Sep 2, 2015
Manage WordPress Orphan Menu Items (drop-in)
View manage-orphan-menu-items.php
class Manage_Orphan_Menu_Items {
function Manage_Orphan_Menu_Items() {
add_action( 'admin_init', array( $this, 'process_menu_item_delete' ) );
add_action( 'admin_menu', array( $this, 'add_admin_page' ) );
function add_admin_page() {
You can’t perform that action at this time.