This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (! function_exists('cleanWordBreaks')) { | |
function cleanWordBreaks(string $text): string | |
{ | |
$cleanText = $text; | |
$cleanup = []; | |
$makeReplacement = function ($regex, $replacement = '') use (&$cleanup, &$cleanText) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
! defined('ABSPATH') && exit; | |
add_action('plugins_loaded', function () { | |
if (// is network install and main site is not set up | |
(is_multisite() && ! get_blog_option(1, 'siteurl')) | |
// is single site install and site is not set up | |
|| (! is_multisite() && ! is_blog_installed()) | |
// ACF is already installed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$singleton = get_class( | |
new class | |
{ | |
protected static $instance; | |
public static function getInstance() | |
{ | |
if (! isset(self::$instance)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get a private property from an object. | |
* | |
* @param object $that | |
* @param string $var | |
* @return mixed | |
*/ | |
function &getPrivateProp(&$that, $var): mixed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('admin_bar_menu', function ($wp_admin_bar) { | |
$wp_admin_bar->remove_node('wp-logo'); | |
}, 999); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Some plugins set 5xx status when code runs through expected flows. | |
* This is to track this since it does not trigger any PHP error logs, | |
* so that you have some idea why a site fails with 5xx. | |
*/ | |
add_action ('status_header', function ($status_header, $code, $description, $protocol) { | |
if ( $code >= 500 ) { | |
$backtrace = Logger::debugBacktrace(); | |
$this->logger->error( "Server-side error detected: $status_header. Backtrace: $backtrace" ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'show_advanced_plugins', function ($default, $type) { | |
return $type == 'mustuse' ? false : $default; | |
}, 10, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App; | |
class PostHasTerm extends \ACF_Location | |
{ | |
public function initialize() | |
{ | |
$this->name = 'post_has_term'; | |
$this->label = __('Post Has Term'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: WP Debug Function | |
Description: A Must-Use plugin that makes the wp_debug_var available to your WordPress Installation | |
Plugin URI: https://gist.github.com/broskees/18c6b10a491d2946fbbfed96a8dd6dc4 | |
Version: 1.0.0 | |
Author: Joseph Roberts | |
Author URI: https://github.com/broskees | |
License: GPLv2 or later | |
License URI: http://www.gnu.org/licenses/gpl-2.0.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Don't break my homepage mu-plugin | |
* | |
*/ | |
add_filter('user_can_richedit', function ($can) { | |
global $post; | |
if ($post_ID === (int) get_option('page_on_front')) { | |
return false; |
NewerOlder