Support » Plugin: Dynamic Featured Image » Getting image descriptions

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Ankit

    (@ankitpokhrel)

    Hello Chris,

    Thank you for using the plugin. I haven’t provided any function to fetch the description of an image but you can do it using similar function.

    /*
    * Get image description
    * This code is not tested
    * @return String
    */
     function dfi_get_image_description( $image_url ) {
        global $wpdb;
        $prefix = $wpdb->prefix;
        $post_description = $wpdb->get_col( $wpdb->prepare( "SELECT post_content FROM " . $prefix . "posts" . " WHERE guid = %s", $image_url ) );
    
        return empty($post_description ) ? null : $post_description[0];
     }

    Thanks,
    Ankit

    Thank you very much, that helps!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Getting image descriptions’ is closed to new replies.