I am not very old on Wordpress.
I am developing a website which has a Third party plugin having class Plugin_Class
and there are some filters in the construct of it. I want to hook my additional function to filter Plugin_filter_1
from functions.php.
I have tried with the syntax add_filter( 'Plugin_filter_1', array('Plugin_Class', 'my_function_defined_in_functions_php' ) );
,
it gives me error even if the class is visible ( checked with get_declared_classes()
)
The detailed answer will be appreciated
Thanks for your help Regards
Possibly the issue is that your second parameter for add_filter
is an array with Plugin_Class
as the first element- this means wordpress will try to fire PluginClass::my_function_defined_in_functions_php
, which doesn't exist.
Instead, just pass it a string of 'my_function_defined_in_functions_php'
.
If this doesn't work with just this edit, show us the code in the plugin class- including the class name and entire construct method. There are more possible issues.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.