Last active
May 5, 2021 06:19
-
-
Save sitebuilderone/1a88a4cd2ec4d2e16e22c783efd57619 to your computer and use it in GitHub Desktop.
WP fun-functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// WP fun-functions | |
/* | |
* Custom favicon | |
*/ | |
function my_favicon() | |
{ ?> | |
<link rel="shortcut icon" href="https://www.---.com/your-custom-image.jpg" > | |
<?php } | |
add_action('wp_head', 'my_favicon'); | |
/* | |
* Fully Disable Gutenberg editor | |
*/ | |
add_filter('use_block_editor_for_post_type', '__return_false', 10); | |
// Don't load Gutenberg-related stylesheets. | |
add_action( 'wp_enqueue_scripts', 'remove_block_css', 100 ); | |
function remove_block_css() | |
{ | |
wp_dequeue_style( 'wp-block-library' ); // WordPress core | |
wp_dequeue_style( 'wp-block-library-theme' ); // WordPress core | |
wp_dequeue_style( 'wc-block-style' ); // WooCommerce | |
wp_dequeue_style( 'storefront-gutenberg-blocks' ); // Storefront theme | |
} | |
/* | |
* Remove widget areas from WP Admin dashboard | |
*/ | |
function disable_default_dashboard_widgets() { | |
remove_meta_box('dashboard_right_now', 'dashboard', 'core'); | |
remove_meta_box('dashboard_recent_comments', 'dashboard', 'core'); | |
remove_meta_box('dashboard_incoming_links', 'dashboard', 'core'); | |
remove_meta_box('dashboard_plugins', 'dashboard', 'core'); | |
remove_meta_box('dashboard_quick_press', 'dashboard', 'core'); | |
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'core'); | |
remove_meta_box('dashboard_primary', 'dashboard', 'core'); | |
remove_meta_box('dashboard_secondary', 'dashboard', 'core'); | |
} | |
add_action('admin_menu', 'disable_default_dashboard_widgets'); | |
// Remove default user roles (from wpsnipp.com) | |
function wps_remove_role() { | |
// remove_role( 'editor' ); | |
remove_role( 'author' ); | |
remove_role( 'contributor' ); | |
remove_role( 'subscriber' ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment