Hi avobelle,
ich habe soeben ein paar Änderungen am Code für dich vorgenommen und die Plugin-Version 2.3.4 released.
Wenn du auf die aktuelle Version updatest kannst du über ein Plugin oder die functions.php deines Themes einzelne Ausgaben der Metatags deaktivieren.
Hier der Code – lösche einfach die Actions die du beibehalten möchtest:
if(isset($plugin_dpc) && is_object($plugin_dpc)){
remove_action('wp_footer', array($plugin_dpc->getModuleInstance('professional_sharing'), 'action_printSocialMetaMicrodata'), 10);
remove_action('wp_head', array($plugin_dpc->getModuleInstance('professional_sharing'), 'action_printOpenGraphMeta'), 10);
remove_action('wp_head', array($plugin_dpc->getModuleInstance('basic_metadata'), 'action_printOpenGraphMeta'), 10);
remove_action('wp_head', array($plugin_dpc->getModuleInstance('basic_metadata'), 'action_printVerifyMeta'), 10);
remove_action('wp_head', array($plugin_dpc->getModuleInstance('basic_metadata'), 'action_printCanonicalTag'), 10);
remove_action('wp_head', array($plugin_dpc->getModuleInstance('basic_metadata'), 'action_printMetaKeywords'), 10);
remove_action('wp_head', array($plugin_dpc->getModuleInstance('basic_metadata'), 'action_printMetaDescription'), 10);
}
Danke dir Christian! Das baue ich gerne mal so ein und teste es dann nochmals. Bleibt das functions.php erhalten wenn ich das Theme update?
Jetzt muss ich doch nochmals reagieren: Wie geil ist denn das?? Ich bin mir nicht bei allem sicher was es ist (canonicaltag, verifymeta), aber wenn ich nur die OpenGraph rausnehme kann ich das perfekt ansteuern, dass alles andere erhalten bleibt.
Besser hätte ich mir das nicht vorstellen können – vielen Dank!
Bleibt nur die Frage bezüglich Theme Update 🙂
Hi avobelle,
freut mich, dass dir das umschreiben des Codes geholfen hat =)
Durch ein Theme-Update wird die functions.php überschrieben.
Du kannst aber ein Child-Theme erstellen und das in dessen functions.php schreiben – oder eben eine eigene Plugin-Datei (Google dich am besten ein Bisschen durch).
Ich habs mal über das Code Snippets Plug-in versucht. Allerdings wird der Code dann nicht mehr ausgeführt (wenn ichs direkt ins functions.php reinschreibe schon).
Hast du eine Lösung dazu? Im Code Snippets Forum habe ich mal gelesen das könnte mit dem Timing zusammenhängen (Code Snippets Code wird vor functions.php geladen, dann bringt der Code in Code Snippets natürlich wenig): https://wordpress.org/support/topic/code-working-in-functions-php-but-not-in-code-snippets-plugin/
Liebe Grüsse
Hi avobelle,
wenn ich deinen Link aufrufe wird mir direkt eine Lösung für dein Problem angezeigt =)
add_action( 'init', function () {
if(isset($plugin_dpc) && is_object($plugin_dpc)){
remove_action('wp_footer', array($plugin_dpc->getModuleInstance('professional_sharing'), 'action_printSocialMetaMicrodata'), 10);
remove_action('wp_head', array($plugin_dpc->getModuleInstance('professional_sharing'), 'action_printOpenGraphMeta'), 10);
remove_action('wp_head', array($plugin_dpc->getModuleInstance('basic_metadata'), 'action_printOpenGraphMeta'), 10);
remove_action('wp_head', array($plugin_dpc->getModuleInstance('basic_metadata'), 'action_printVerifyMeta'), 10);
remove_action('wp_head', array($plugin_dpc->getModuleInstance('basic_metadata'), 'action_printCanonicalTag'), 10);
remove_action('wp_head', array($plugin_dpc->getModuleInstance('basic_metadata'), 'action_printMetaKeywords'), 10);
remove_action('wp_head', array($plugin_dpc->getModuleInstance('basic_metadata'), 'action_printMetaDescription'), 10);
}
} );
Liebe Grüße
Sali Christian
Mit der Lösung hatte ich es getestet, das hat dann aber nicht funktioniert. Ich muss aber auch ehrlich sagen, dass meine Web Development Kenntnisse bei php dann bald mal aufhören 😉 kann also gut sein, dass sich ein Fehler eingeschlichen hat.
Mein Template schreibt aber auch og tags die ich rausnehmen muss und der Template Hersteller sagt das gehe angeblich nur über ein Child Theme. Von daher werde ich deinen Code da auch gleich einbauen.
Danke dir für die Unterstützung 🙂