Skip to content

Instantly share code, notes, and snippets.

Bjørn Johansen bjornjohansen

View GitHub Profile
@bjornjohansen
bjornjohansen / gravityforms-privacyactions.php
Last active May 24, 2018
Personal data exporter and eraser for Gravity Forms.
View gravityforms-privacyactions.php
<?php
/**
* Personal data exporter and eraser for Gravity Forms.
*
* @package BJ\GravityForms\PrivacyActions
* @author bjornjohansen
* @version 0.1.1
* @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License version 2 (GPLv2)
*/
@bjornjohansen
bjornjohansen / class-assetspusher.php
Created Jan 29, 2018
HTTP/2 server push WordPress assets
View class-assetspusher.php
<?php
/**
* HTTP/2 server push WordPress assets.
*
* @package BJ\AssetsPusher
* @author bjornjohansen
* @version 0.1.0
* @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License version 2 (GPLv2)
*/
@bjornjohansen
bjornjohansen / wordpress.conf
Last active Nov 16, 2018
Nginx config for WordPress
View wordpress.conf
index index.php index.html;
# Don’t log favicon requests
location /favicon.ico {
log_not_found off;
access_log off;
}
# Disallow access to readme.html
location /readme.html {
@bjornjohansen
bjornjohansen / menu-item-inserter.php
Created Jan 20, 2018
Horribly inefficient function to create a menu with all pages as menu items.
View menu-item-inserter.php
<?php
/**
* Insert menu items for all pages.
*
* @package BJ\Menu
* @author bjornjohansen
* @version 0.1.0
* @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License version 2 (GPLv2)
*/
@bjornjohansen
bjornjohansen / logging.php
Last active Mar 28, 2019
Simple logging for WordPress
View logging.php
<?php
/**
* Simple logging for WordPress.
*
* @package BJ\Log
* @author bjornjohansen
* @version 0.1.0
* @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License version 2 (GPLv2)
*/
@bjornjohansen
bjornjohansen / wordpress-menu-cache-timing.php
Created Jan 20, 2018
Timing for the WordPress menu cache
View wordpress-menu-cache-timing.php
<?php
/**
* WordPress menu cache timing.
*
* @package BJ\Menu
* @author bjornjohansen
* @version 0.1.0
* @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License version 2 (GPLv2)
*/
View wordpress-menu-cache.php
<?php
/**
* WordPress menu cache.
*
* @package BJ\Menu
* @author bjornjohansen
* @version 0.1.0
* @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License version 2 (GPLv2)
*/
@bjornjohansen
bjornjohansen / auth.php
Last active Jan 22, 2018
Changes the expiration of the WordPress authentication cookie to 365 days if the user ticks the “Remember Me” checkbox.
View auth.php
<?php
/**
* Authentication customizations.
*
* @package BJ\Auth
*/
/**
* Filters the duration of the authentication cookie expiration period.
*
@bjornjohansen
bjornjohansen / maintenance.php
Created Aug 31, 2017
Custom WordPress maintenance mode page
View maintenance.php
<?php
wp_load_translations_early();
$protocol = wp_get_server_protocol();
header( "$protocol 503 Service Unavailable", true, 503 );
header( 'Content-Type: text/html; charset=utf-8' );
header( 'Retry-After: 30' );
?>
<!DOCTYPE html>
<html>
View keybase.md

Keybase proof

I hereby claim:

  • I am bjornjohansen on github.
  • I am bjornjohansen (https://keybase.io/bjornjohansen) on keybase.
  • I have a public key ASCrTUGCadfybRYNvfqSValmQEdSig65WPGxp2HvGsifigo

To claim this, I am signing this object:

You can’t perform that action at this time.