Hi. I'm trying to display the MB Favorites page as a WP Gridbuilder grid but I wasn't successful so far. I added this snippet to set a specific grid (id 2) to show the user mbfp_posts:
function prefix_query_args( $query_args, $grid_id ) {
$user_id = wp_get_current_user();
$favorites = get_user_meta( $user_id, 'mbfp_posts', false );
if ( 2 === $grid_id ) {
$query_args['post__in'] = $favorites;
}
return $query_args;
}
add_filter( 'wp_grid_builder/grid/query_args', 'prefix_query_args', 10, 2 );
But when adding the grid via the shortcode [wpgb_grid id="2"], it shows all posts instead of the ones I marked as favorite. Any thoughts?
Thank you.