Skip to content

Instantly share code, notes, and snippets.

@nat-c
nat-c / nc-custom-wp-error-pages
Last active February 9, 2023 10:37
Custom WordPress Error Pages (not 404; this one is handled via your theme): A php snippet to put in your functions.php or in your plugin to get rid of the default WP error pages and have custom ones that match with your theme. The code is taken from a CRM application I'm building on top of WordPress [personal project] and slightly modified to be…
<?php
add_filter( 'wp_die_handler', 'nc_get_custom_error_handler' );
function nc_get_custom_error_handler() {
return 'nc_custom_error_handler';
}
function nc_custom_error_handler( $message, $title = '', $args = array() ) {
$defaults = array( 'response' => 500, 'back_link' => false );
@nat-c
nat-c / Remove-Monarch-Plugin-"Open-Sans"-stylesheet.php
Last active April 14, 2020 05:55
Remove Monarch Plugin "Open Sans" stylesheet : Code snippet to add to your CHILD Theme's functions.php
<?php // <--- you don't need to include this. Your functions.php file already starts with it.
/** We need to include this line, otherwise the "if is plugin active" check won't work **/
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
/**
* Create (and name) a function
* to load your parent's stylesheet, (it's much better than the "@import" method!)
* any extra styles, and of course to remove styles as well