Skip to content

Instantly share code, notes, and snippets.

@jom
Created December 4, 2018 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jom/46ef6647c454b11e2abe1df0d9ef3ad6 to your computer and use it in GitHub Desktop.
Save jom/46ef6647c454b11e2abe1df0d9ef3ad6 to your computer and use it in GitHub Desktop.
Prevent Product Dropdown on Sensei Course Page
<?php
add_action( 'add_meta_boxes', function() {
remove_meta_box( 'course-wc-product', 'course', 'side' );
add_meta_box( 'course-wc-product', __( 'WooCommerce Product', 'woothemes-sensei' ), function() {
if ( ! function_exists( 'Sensei' ) ) { return; }
global $post;
$select_course_woocommerce_product = get_post_meta( $post->ID, '_course_woocommerce_product', true );
echo '<input type="hidden" name="' . esc_attr( 'woo_course_noonce' ) . '" id="' . esc_attr( 'woo_course_noonce' ) . '" value="' . esc_attr( wp_create_nonce( plugin_basename( Sensei()->plugin_path ) ) ) . '" />';
echo '<label for="wc-course-product-id">Product ID</label><br />';
echo '<input type="text" id="wc-course-product-id" value="' . esc_attr( absint( $select_course_woocommerce_product ) ) . '" name="course_woocommerce_product" />';
}, 'course', 'side', 'default' );
}, 21 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment