Skip to content

Instantly share code, notes, and snippets.

@edlefebvre
edlefebvre / delete_git_submodule.md
Created November 13, 2020 13:04 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@edlefebvre
edlefebvre / maintenance-mode.php
Last active January 22, 2020 10:08
WP Maintenance mu-plugin - redirect to login page
<?php
// Exit if accessed directly
if ( !defined('ABSPATH') ) exit;
/**
* Plugin Name: Maintenance mode
* Description: maintenance mode.
* Author: EDL
* Author URI:
* Version: 1.1
@edlefebvre
edlefebvre / fragment-caching.php
Created October 8, 2019 13:27
Fragment caching function
<?php
/**
* Fragment caching function
* see: https://css-tricks.com/wordpress-fragment-caching-revisited/
*
* Usage:
* <?php fragment_cache('frc_footer', DAY_IN_SECONDS, function() { ?>
* code to cache (loops etc)
* <?php }); // end fragment_cache ?>
*/