Skip to content

Instantly share code, notes, and snippets.

<?php
function reorder_admin_menu( $menu_items ) {
// Our top level items
$top_level = array();
// Post Types
$post_types = array();
// Our bottom level items
$bottom_level = array();
// And our penalty box...known that we want last
@bob-moore
bob-moore / elementor-mods.php
Last active April 4, 2023 12:45
Removing core theme builder locations in Elementor. The first file is the original file in Elementor, just for reference. The second is a mu plugin to disable select locations. This must be ran via plugin or mu-plugin, because it runs before themes are loaded.
<?php
/**
* Plugin Name: Elementor Mods
* Plugin URI: https://gist.github.com/bob-moore/986bafade1aa0b04bb30e0a2f08fb105
* Description: Mod some elementor stuff
* Version: 0.1.0
* Author: Bob Moore
* Author URI: https://github.com/bob-moore
* License: GPL-2.0+
<?php
function prefix_print_error( $item, $action = 'shutdown' ) {
add_action( $action, function() use( $item ) {
printf( '<script>console.log(%s);</script>', json_encode( $item, JSON_PARTIAL_OUTPUT_ON_ERROR, JSON_PRETTY_PRINT ) );
}, 9999 );
}
<?php
function generate_price_metadata( $product_id ) {
/**
* Get the product based on ID
*/
$product = wc_get_product( $product_id );
/**
* This should be set during import to false
*
@bob-moore
bob-moore / login-custom-plugin.php
Created March 21, 2022 16:59
Quick plugin to disable astra transparent header on login page
<?php
/**
* @wordpress-plugin
* Plugin Name: CUSTOM PLUGIN NAME
* Plugin URI: https://YOURDOMAIN.com
* Description: CUSTOM PLUGIN DESCRIPTION
* Version: 1.0.0
* Author: YOUR NAME
* Author URI: https://YOURDOMAIN.com
* License: GPL-2.0+