Skip to content

Instantly share code, notes, and snippets.

@contemplate
contemplate / functions.php
Created April 26, 2022 00:35
WooCommerce - Disable guest checkout for certain products when Guest checkout is Enabled globally
/*--------------------------------------
Woocommerce - Disallow Guest Checkout on Certain products
----------------------------------------*/
// Display Guest Checkout Field
add_action( 'woocommerce_product_options_general_product_data', 'woo_add_disable_gc_fields' );
function woo_add_disable_gc_fields() {
global $woocommerce, $post;
echo '<div class="options_group">';
@mlbd
mlbd / Create Programmatically WordPress Nav menu
Last active July 21, 2023 13:25
Programmatically create wp nav menu from external json file
/**
* Registers a wp nav menu Programmatically.
*
* @link https://codex.wordpress.org/Function_Reference/wp_get_nav_menu_object
* @link https://codex.wordpress.org/Function_Reference/wp_create_nav_menu
* @link https://developer.wordpress.org/reference/functions/wp_update_nav_menu_item/
* @link https://developer.wordpress.org/reference/functions/wp_remote_get/
* @link https://codex.wordpress.org/Function_API/wp_remote_retrieve_body
*
* @since 1.0