{"id":11690,"date":"2014-06-16T17:22:44","date_gmt":"2014-06-16T15:22:44","guid":{"rendered":"https:\/\/www.saasweb.agency\/blog\/wordpress-modifying-or-adding-stylesheets-with-wp_enqueue_style-and-wp_dequeue_style\/"},"modified":"2026-10-27T08:32:45","modified_gmt":"2026-10-27T07:32:45","slug":"wordpress-modifying-or-adding-stylesheets-with-wp_enqueue_style-and-wp_dequeue_style","status":"publish","type":"post","link":"https:\/\/www.saasweb.agency\/en\/blog\/wordpress-modifying-or-adding-stylesheets-with-wp_enqueue_style-and-wp_dequeue_style\/","title":{"rendered":"WordPress: Modifying or Adding Stylesheets with wp_enqueue_style and wp_dequeue_style"},"content":{"rendered":"<p><img decoding=\"async\" class=\"alignleft wp-image-549 size-full\" src=\"https:\/\/www.saasweb.agency\/wp-content\/uploads\/2011\/11\/wordpress-logo.png\" alt=\"WordPress Logo\" width=\"150\" height=\"150\" srcset=\"https:\/\/www.saasweb.agency\/wp-content\/uploads\/2011\/11\/wordpress-logo.png 150w, https:\/\/www.saasweb.agency\/wp-content\/uploads\/2011\/11\/wordpress-logo-50x50.png 50w, https:\/\/www.saasweb.agency\/wp-content\/uploads\/2011\/11\/wordpress-logo-100x100.png 100w, https:\/\/www.saasweb.agency\/wp-content\/uploads\/2011\/11\/wordpress-logo-140x140.png 140w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/>Anyone who has worked with WordPress knows that plugins often bring their own styles, which may need to be adjusted. Of course, it is not a good idea to change styles directly within the plugin, as these customizations will be lost during the next update. Furthermore, plugin styles often cannot be overwritten using the style.css in the root directory because they are frequently loaded later in the process.  <\/p>\n<p>How it works: <a title=\"WP enqueue function\" href=\"http:\/\/codex.wordpress.org\/Function_Reference\/wp_enqueue_style\" target=\"_blank\" rel=\"noopener\">wp_enqueue_style<\/a> \/ <a title=\"WordPress dequeue function\" href=\"http:\/\/codex.wordpress.org\/Function_Reference\/wp_dequeue_style\" target=\"_blank\" rel=\"noopener\">wp_dequeue_style<\/a><\/p>\n<pre class=\"wp-block-code\"><code># Der Code hier sollte in die functions.php eingetragen werden\n# Sollte das Theme ein Child-Theme sein, und es gibt noch keine functions.php in \n# dem Child-Theme-Verzeichnis, dann gen\u00fcgt eine eigene functions.php in dem \n# Child-Theme Verzeichnis mit den Angaben hier unten (die neuen Anweisungen \n# und Funktionen erg\u00e4nzen dann die functions.php des Parent-Themes)\n#\n# Hier wird verhindert, das \"Problem_Stylesheet\" zu laden\n# 'plugin-style' ist der unique Identifier\n\nfunction plugin_style_drop(){\n  wp_dequeue_style( 'plugin-style' );\n}\n\n# Hier wird ein extra Stylesheet eingebunden\n# Beispielsweise um die Stylesheet Informationen eines Formular-PlugIns zu \u00fcberschreiben\n\nfunction style_extension_scripts() {\n  wp_enqueue_style( 'custom-plugin-style', get_template_directory_uri() . '\/plugin-new-style.css' );\n}\n\n# Hier werden die Funktionen ausgef\u00fchrt\n# wp_print_scripts; diese Funktion stellt sicher, dass das zu \n# dequeuende Style auch geladen wurde, um es sicher zu entfernen\n# Die Prio wird als drittes Argument in add_action hinzugef\u00fcgt,\n# der Wert kann individuell angepasst werden\n\nadd_action( 'wp_print_scripts', 'plugin_style_drop', 100 );\nadd_action( 'wp_enqueue_scripts', 'style_extension_scripts', 101 );<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Anyone who has worked with WordPress knows that plugins often bring their own styles, which may need to be adjusted. Of course, it is not a good idea to change styles directly within the plugin, as these customizations will be lost during the next update. Furthermore, plugin styles often cannot be overwritten using the style.css \u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[981,983],"tags":[819],"class_list":["post-11690","post","type-post","status-publish","format-standard","hentry","category-programming","category-tutorial","tag-wordpress"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.saasweb.agency\/en\/wp-json\/wp\/v2\/posts\/11690","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.saasweb.agency\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.saasweb.agency\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.saasweb.agency\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.saasweb.agency\/en\/wp-json\/wp\/v2\/comments?post=11690"}],"version-history":[{"count":0,"href":"https:\/\/www.saasweb.agency\/en\/wp-json\/wp\/v2\/posts\/11690\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.saasweb.agency\/en\/wp-json\/wp\/v2\/media?parent=11690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.saasweb.agency\/en\/wp-json\/wp\/v2\/categories?post=11690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.saasweb.agency\/en\/wp-json\/wp\/v2\/tags?post=11690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}