2017-09-05 3 views
0

Guten Abend an alle, ich habe ein kleines Problem beim Entfernen einer Aktion von wp_head, die von Wordpress Download Manager hinzugefügt wurde. Das ist der Code aus dem Plugin:remove_action aus einer Plug-in-Klasse in einem anderen Namespace

class WordPressDownloadManager{ 
 

 
    function __construct(){ 
 

 
     register_activation_hook(__FILE__, array($this, 'Install')); 
 

 
     add_action('init', array($this, 'registerPostTypeTaxonomy'), 1); 
 

 
     add_action('plugins_loaded', array($this, 'loadTextdomain')); 
 
     add_action('wp_enqueue_scripts', array($this, 'EnqueueScripts')); 
 

 
     add_action('wp_head', array($this, 'wpHead')); 
 
     add_action('wp_footer', array($this, 'wpFooter')); 
 

 
     spl_autoload_register(array($this, 'AutoLoad')); 
 

 
     new \WPDM\libs\UserDashboard(); 
 
     new \WPDM\libs\Apply(); 
 
     new \WPDM\admin\WordPressDownloadManagerAdmin(); 
 
     new \WPDM\ShortCodes(); 
 

 
    }

und dies ist der Code ich verwende es zu entfernen:

function remove_wpdm() { 
 
    remove_action('wp_head', array('WordPressDownloadManager', 'wpHead')); 
 
} 
 
add_action('wp_head', 'remove_wpdm');

ohne Effekte .. Wie kann ich das lösen? Diese Klasse befindet sich in einem anderen Namensraum namens WPDM. Vielen Dank im Voraus für jede Hilfe.

Mit freundlichen Grüßen, Domenico

+0

Warum Sie diesen Code nicht in Kommentar setzen: add_action ('wp_head', array ($ this, 'wpHead')); –

+0

@ user8262086 Ich sah diese Dokumentation vor und ich dachte, dass es richtig war, 'remove_action ('wp_head', array ('WordPressDownloadManager', 'wpHead'));' aber es funktioniert nicht ... ich habe kein globales Klasse zu nennen, also musste ich diese Methode verwenden .. vielleicht ein vorrangiges Problem? Ich habe mit höheren Prioritäten ohne Wirkung versucht. Danke –

+0

@AkshayShah, weil ich diesen Code auf einer einzelnen spezifischen Seite aktivieren möchte. Der Code wird benötigt, damit das Plugin funktioniert, aber es ist nicht notwendig auf Seiten, die es nicht benutzen .. –

Antwort

0

Try Code unten

function remove_wpdm() { 
    remove_action('wp_head', array('WordPressDownloadManager', 'wpHead')); 
} 
add_action('init', 'remove_wpdm'); 
+0

Immer noch nicht funktioniert .. :( –

Verwandte Themen