I am trying to build a slider of users with vendors role, and trying to get the vendors url from dokan plugin here is what I am trying to generate the link for each vendor in the slider loop but it is not working :
function store_query_filter( $query ) {
global $wp_query;
$author = get_query_var( $query->custom_store_url );
if ( !is_admin() && $query->is_main_query() && !empty( $author ) ) {
$seller_info = get_user_by( 'slug', $author );
$store_info = dokan_get_store_info( $seller_info->data->ID );
if ( !empty( $store_info['store_name'] ) ) {
$vendor_link = dokan_get_store_url( $store_info->ID );
return $vendor_link;
}
}
}
add_shortcode( 'store_vendor_url', 'store_query_filter' );