Filter mbfp_posts with WP Gridbuilder

Support MB Favorite Posts Filter mbfp_posts with WP GridbuilderResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #39092
    Lucas K.Lucas K.
    Participant

    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.

    #39105
    PeterPeter
    Moderator

    Hello Lucas,

    In case of using Oxygen Builder, WP Grid Builder, please reach out to them if you have any issues with installation, configuration, compatibility, or usage.

    Refer to our support policy https://metabox.io/support/topic/support-policy/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.