add_filter(‘auto_update_plugin’, ‘__return_false’);
Kategorie: WordPress
Plugins(37)
Füge benutzerdefinierte Schriftarten hinzu
function add_custom_fonts() { wp_enqueue_style(‘custom-fonts’, ‘https://fonts.googleapis.com/css?family=Font1|Font2’); } add_action(‘wp_enqueue_scripts’, ‘add_custom_fonts’);
Füge benutzerdefinierte Felder zur Mediathek hinzu
function add_custom_media_fields($form_fields, $post) { $form_fields[‘custom_field’] = array( ‘label’ => ‘Benutzerdefiniertes Feld’, ‘input’ => ‘text’, ‘value’ => get_post_meta($post->ID, ‘_custom_field’, true), ); return $form_fields; } add_filter(‘attachment_fields_to_edit’, ‘add_custom_media_fields’, 10, 2); function save_custom_media_fields($post, $attachment) { update_post_meta($post[‘ID’], ‘_custom_field’, $attachment[‘custom_field’]); return $post; } add_filter(‘attachment_fields_to_save’, ‘save_custom_media_fields’, 10, 2);
Füge benutzerdefinierten Code zum Header hinzu
function custom_header_code() { echo ‘<!– Dein Header-Code hier –>’; } add_action(‘wp_head’, ‘custom_header_code’);
Deaktiviere die WordPress-REST-API
function disable_rest_api() { return new WP_Error(‘rest_disabled’, ‘Die REST-API wurde deaktiviert.’, array(‘status’ => 403)); } add_filter(‘rest_authentication_errors’, ‘disable_rest_api’);
Ändere das Standard-Image-Upload-Verzeichnis
function custom_upload_dir($path) { $upload_dir = wp_upload_dir(); $path[‘path’] = $upload_dir[‘basedir’] . ‘/custom’; $path[‘url’] = $upload_dir[‘baseurl’] . ‘/custom’; return $path; } add_filter(‘upload_dir’, ‘custom_upload_dir’);
Entferne die Version von WordPress aus dem Header
function remove_wp_version() { return ”; } add_filter(‘the_generator’, ‘remove_wp_version’);
Deaktiviere das WordPress-Emoji-Script
function disable_emojis() { remove_action(‘wp_head’, ‘print_emoji_detection_script’, 7); remove_action(‘admin_print_scripts’, ‘print_emoji_detection_script’); remove_action(‘wp_print_styles’, ‘print_emoji_styles’); remove_action(‘admin_print_styles’, ‘print_emoji_styles’); remove_filter(‘the_content_feed’, ‘wp_staticize_emoji’); remove_filter(‘comment_text_rss’, ‘wp_staticize_emoji’); remove_filter(‘wp_mail’, ‘wp_staticize_emoji_for_email’); } add_action(‘init’, ‘disable_emojis’);
Versandkostenfrei für Stammkunden aktivieren
add_filter(‘woocommerce_shipping_free_shipping_threshold’, ‘free_shipping_for_returning_customers’); function free_shipping_for_returning_customers($threshold) { if (is_user_logged_in() && current_user_can(‘customer_group’)) { $threshold = 0; // Versandkostenfrei für Stammkunden } return $threshold; }
Warenkorb automatisch leeren, wenn ein Produkt hinzugefügt wird
add_action(‘woocommerce_add_to_cart’, ’empty_cart_on_add’); function empty_cart_on_add() { WC()->cart->empty_cart(); }