Category: Admin
WPCode Library
Fix Custom Schema field collapsing in smaller screens
add_action(‘admin_head’, ‘aioseo_fix_custom_schema_field’); function aioseo_fix_custom_schema_field() { echo ‘ ‘; }Continue reading
Untitled Snippet
add_filter( ‘aioseo_robots_meta’, ‘aioseo_filter_robots_meta’ ); function aioseo_filter_robots_meta( $attributes ) { $url = home_url( $_SERVER[‘REQUEST_URI’] ); if (strpos($url,’product_search=’) !== false) { $attributes[‘index’] = “noindex”; }; return $attributes; }Continue reading
Allow ico Files Upload
/*——————————————— TYPE MIME ICO par HP MC&C ———————————————-*/ function allow_ico_mime_types( $mimes ){ $mimes[‘ico’] = ‘image/x-icon’; return $mimes; } add_filter( ‘upload_mimes’, ‘allow_ico_mime_types’ );Continue reading
Convert Customers to Users
function eddccu_add_tools_tab( $tabs ) { $tabs[‘eddccu_customers’] = __( ‘Customers’, ‘edd-convert-customers-to-users’ ); return $tabs; } add_filter( ‘edd_tools_tabs’, ‘eddccu_add_tools_tab’ ); /** * Display the Customers tab content in Downloads > Tools */ function eddccu_display_tools_tab() { if ( !current_user_can( ‘manage_shop_settings’ ) ) {…Continue reading
Conversion Event Snippet
Disable Widget Blocks (Enable Classic Widgets)
add_filter( ‘use_widgets_block_editor’, ‘__return_false’ );Continue reading
Disable Gutenberg Editor (Enable Classic Editor)
add_filter(‘gutenberg_can_edit_post’, ‘__return_false’, 10); add_filter(‘use_block_editor_for_post’, ‘__return_false’, 10);Continue reading
Only Allow SVG Files for Administrators
function wpsnippets_allow_svg_files($mime_types) { // Return original value if user doesn’t have a required capability if (!current_user_can(‘manage_options’)) { return $mime_types; } $mime_types[‘svg’] = ‘image/svg+xml’; $mime_types[‘svgz’] = ‘image/svg+xml’; return $mime_types; } add_filter(‘upload_mimes’, ‘wpsnippets_allow_svg_files’);Continue reading