I’m trying to write my first filter and I’m not sure what I’m doing wrong.
I’m using the Dokan plugin and this file: wp-content/plugins/dokan-lite/includes/functions.php has a function that I don’t like…
/**
* Get product status based on user id and settings
*
* @return string
*/
function dokan_get_new_post_status() {
$user_id = get_current_user_id();
// trusted seller
if ( dokan_is_seller_trusted( $user_id ) ) {
return ‘publish’;
}
// if not trusted, send the option
$status = dokan_get_option( ‘product_status’, ‘dokan_selling’, ‘pending’ );
return $status;
}
What I’m trying to do is change the way the “trusted seller” works. Here’s what I want it to do:
// trusted seller
if ( dokan_is_seller_trusted( $user_id ) ) {
return ‘draft’;
}
When I change the code in the plugin file it does exactly what I want, but the filters I’ve tried to write in my Child Theme have not been able to accomplish the same result.
What am I doing wrong? Thanks in advance.
[ad_2]
What is the filter code you’re trying to write? And where is the apply_filters call that will call it?
If there is no solution, you should post in Dokan forum.
The function in the plugin is an object. That object/function has to be called somewhere. You need to find the filter name that is being used to enact this function, search the plugin files for dokan_get_new_post_status()