• Resolved smeedijzeronline

    (@smeedijzeronline)


    Hi,

    I use a query for images in a specific folder, but it’s not working anymore. What to change?

    $query = new WP_Query([
    ‘post_status’ => ‘inherit’,
    ‘post_type’=> ‘attachment’,
    ‘post_mime_type’ =>array(
    ‘jpg|jpeg|jpe’ => ‘image/jpeg’,
    ‘gif’ => ‘image/gif’,
    ‘png’ => ‘image/png’,
    ),
    ‘orderby’ => ‘rand’,
    ‘posts_per_page’ => 5,
    ‘tax_query’ => array(
    array(
    ‘taxonomy’ => ‘nt_wmc_folder’,
    ‘terms’ => array( ‘uitgelicht’ ),
    ‘field’ => ‘slug’,
    ‘include_children’ => true,
    ‘operator’ => ‘IN’,
    ),
    )
    ]);

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Bruce

    (@ninjateamwp)

    Hi there,

    Thank you for using FileBird and I am sorry to know about that issue, please allow me to get more information from our developers and get back to you soon.

    Thanks.

    Kind regards,
    -Bruce-

    Plugin Support Bruce

    (@ninjateamwp)

    Hi @smeedijzeronline ,

    This is the code that fixed that error:

    $query = new WP_Query([
    ‘post_status’ => ‘inherit’,
    ‘post_type’=> ‘attachment’,
    ‘post_mime_type’ =>array(
    ‘jpg|jpeg|jpe’ => ‘image/jpeg’,
    ‘gif’ => ‘image/gif’,
    ‘png’ => ‘image/png’,
    ),
    ‘orderby’ => ‘rand’,
    ‘posts_per_page’ => 5,
    ‘post__in’ => $wpdb->get_col(“SELECT attachment_id FROM ” . $wpdb->prefix . “fbv_attachment_folder WHERE folder_id = your_folder_id”)
    ]);

    Also, please see the API documentation in case you need it sometimes:
    https://ninjateam.gitbook.io/filebird/api

    Thanks and let us know if you need anything else.

    Kind regards,
    -Bruce-

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Query folder not working anymore’ is closed to new replies.