Skip to content

Instantly share code, notes, and snippets.

View wpchannel's full-sized avatar
:octocat:

Aurélien Denis wpchannel

:octocat:
View GitHub Profile
<?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; ?>
@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 / wp_has_children_pages.php
Last active February 18, 2018 19:08
Test if a page has children or not
<?php
$parent_ID = $post->post_parent ? @ array_pop(get_post_ancestors($post)) : $post->ID;
$children = wp_list_pages(
array(
'child_of' => $parent_ID,
'title_li' => '',
'echo' => false,
)
);
?>
@wpchannel
wpchannel / mu-yoast-seo-disable-notifications.php
Last active April 16, 2023 08:33
Hide annoying notifications after each upgrade of Yoast SEO plugin and others admin notices
<?php if (!defined('ABSPATH')) die('Restricted Area');
/*
* Plugin Name: Disable Yoast SEO Notifications
* Description: Hide annoying notifications after each upgrade of Yoast SEO plugin and others admin notices.
* Version: 1.1
* Author: Aurélien Denis
* Author URI: https://wpchannel.com/
*/
@wpchannel
wpchannel / mu-sanitize-filename.php
Last active January 3, 2024 13:55
Clean file name when uploading in WordPress
<?php if ( ! defined( 'ABSPATH' ) ) {
die( 'Restricted Area' );
}
/*
* Plugin Name: Sanitize File Name
* Description: Clean file name when uploading files in WordPress.
* Version: 20240103
* Author: Mickaël Gris (Saipafo) & Aurélien Denis (WP channel)
* Author URI: https://wpchannel.com/wordpress/tutoriels-wordpress/renommer-automatiquement-fichiers-accentues-wordpress/