Hide plugins from admin list of plugins

function wpcode_custom_hide_plugins() { // Replace “administrator” with the user role you want to target. if ( ! current_user_can( ‘administrator’ ) ) { return; } // Modify the array to match the plugins you want to hide. $plugins_to_hide = array( ‘plugin-slug/plugin-file.php’,…Continue reading

Limit Meta Description to 160 characters

add_filter( ‘aioseo_description’, ‘aioseo_filter_description’ ); function aioseo_filter_description( $description ) { if ( strlen($description) > 160 ) { $description = substr($description, 0, 159); } return $description; }Continue reading

Redirect Pages

function afwerx_redirect() { if (isset($_SERVER[‘HTTPS’]) && ($_SERVER[‘HTTPS’] == ‘on’ || $_SERVER[‘HTTPS’] == 1) || isset($_SERVER[‘HTTP_X_FORWARDED_PROTO’]) && $_SERVER[‘HTTP_X_FORWARDED_PROTO’] == ‘https’) { $protocol = ‘https://’; } else { $protocol = ‘http://’; } $currenturl = $protocol . $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’]; $currenturl_relative = wp_make_link_relative($currenturl);…Continue reading

Tyler Hall Tech Custom Snippets (copy)

// Custom PHP Code by Tyler (TITLE) function page_title_sc( ){ return get_the_title(); } add_shortcode( ‘page_title’, ‘page_title_sc’ ); // Enable Shortcode Execution in Text Widgets add_filter( ‘widget_text’, ‘do_shortcode’ ); // Disable Gutenberg Editor (use Classic Editor) add_filter(‘gutenberg_can_edit_post’, ‘__return_false’, 5); add_filter(‘use_block_editor_for_post’, ‘__return_false’,…Continue reading

Add empty cart class to Body

add_filter(‘body_class’, ‘stw_add_cart_status_class’); function stw_add_cart_status_class($classes) { if (function_exists(‘WC’)) { $cart = WC()->cart; if (isset($cart) && is_callable(array($cart, ‘get_cart_contents_count’))) { $items = $cart->get_cart_contents_count(); $classes[] = $items?’cart_has_items’:’cart_is_empty’; } } return $classes; }Continue reading

Third Party – Cart Mods

function filter_woocommerce_cart_item_class( $string, $cart_item, $cart_item_key ) { // Get the product categories slugs for this item $term_slugs = wp_get_post_terms( $cart_item[‘product_id’], ‘product_cat’, array( ‘fields’ => ‘slugs’ ) ); // NOT empty if ( ! empty ( $term_slugs ) ) { $string…Continue reading