Custom Fields
Re-Envisioned
Support MB Custom Table Query Posts With WP_Query

  • Creator
    Topic
  • #17996
    Resolved Dave
    Participant

    The code found in the documentation below does not work when the $ids = []. This is the case when no data is returned and ‘post__in’ filter does nothing. This may need to be modified. There is also a typo in the documentation. The first line has $ids but in the query, $id is used.

    global $wpdb;
    $ids = $wpdb->get_col( "SELECT ID FROM your_table WHERE field1 = 'value1' OR field2 = 'value2'" );
    
    $query = new WP_Query( [
        'post_type' => 'post',
        'post__in'  => $id,
    ] );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.

Newsletter

Subscribe to our newsletter to receive news and tutorials for Meta Box and WordPress.


grid gear info copy caret-up caret-down trash