Skip to content

Instantly share code, notes, and snippets.

View wpchannel's full-sized avatar
:octocat:

Aurélien Denis wpchannel

:octocat:
View GitHub Profile
@wpchannel
wpchannel / mu-unregister-taxonomies.php
Last active February 18, 2018 19:07
Unregister any WordPress taxonomy
<?php if (!defined('ABSPATH')) die('Restricted Area');
/*
* Plugin Name: Unregister Taxonomies
* Description: Properly disable any WordPress taxonomy.
* Version: 20160901
* Author: Aurélien Denis (Neticpro)
* Author URI: https://wpchannel.com/desactiver-taxonomie-type-de-contenu-personnalise/
*/
@wpchannel
wpchannel / mu-disable-woocommerce-notice.php
Last active February 18, 2018 19:07
Disable WooCommerce.com account notice
/* Disable WooCommerce.com Account Notice */
add_filter('woocommerce_helper_suppress_admin_notices', '__return_true');
function wpc_dequeue_woocommerce_styles_scripts() {
if (function_exists('is_woocommerce')) {
if (! is_woocommerce() && ! is_cart() && ! is_checkout() && ! is_account_page()) {
wp_dequeue_style('woocommerce-general');
wp_dequeue_style('woocommerce-layout');
wp_dequeue_style('woocommerce-smallscreen');
wp_dequeue_script('wc_price_slider');
wp_dequeue_script('wc-single-product');
wp_dequeue_script('wc-add-to-cart');
function wpc_exclude_protected_posts($query) {
if (! is_admin() && $query->is_main_query()) {
$query->set('has_password', false);
}
}
add_action('pre_get_posts', 'wpc_exclude_protected_posts');
<?php if (wcs_user_has_subscription('', 10, 'active')) : // Replace 10 by WooCommerce Subscription Product ID ?>
<?php _e('Hello World', 'textdomain'); ?>
<?php else : ?>
<p><?php _e('Sorry you have to be an active subscriber to get access.', 'textdomain'); ?></p>
<?php endif; ?>