Forum Replies Created

Viewing 1 replies (of 1 total)
  • maheshwarisaket

    (@maheshwarisaket)

    I am facing a similar problem even after trying the new code. I am getting the following warning- “PHP Warning: Invalid argument supplied for foreach() in ***/httpdocs/wp-content/plugins/lightbox/lightbox.php on line 211

    My current code is:

    function get_images_url(){
    global $wpdb;
    $image_urls = $_POST[‘urls’];
    $all_urls = array();
    foreach ($image_urls as $image_url) {
    $query = $wpdb->prepare(“SELECT ID FROM $wpdb->posts WHERE guid=’%s'”, $image_url);
    $id = $wpdb->get_var($query);
    $attachment = get_post( $id );
    $description = $attachment->post_content;
    array_push($all_urls,$description);
    }
    echo json_encode($all_urls);
    die();
    }

    Could you help with which code to use. Thanks!

Viewing 1 replies (of 1 total)