public function get_file( $value ) {
		$meta_key = $this->get_setting( 'meta_key' );

		if ( empty( $meta_key ) ) {
			if ( is_numeric( $value ) && intval( $value ) !== 0 ) {
				$post = get_post( $value );
			}
		} else if ( ! empty( $value ) ) {
			$args = [
				'fields'         => 'ids',
				'meta_key'       => $meta_key,
				'meta_value'     => $value,
				'posts_per_page' => 1,
				'post_type'      => 'attachment',
				'post_status'    => 'any'
			];

			$query = new WP_Query( $args );

			if ( ! empty( $query->posts ) ) {
				$post = get_post( $query->posts[0] );
			}
		}

		if ( empty( $post ) ) {
			return $value;
		}

		return $post->ID;
	}
public function get_file( $value ) {
		$meta_key = $this->get_setting( 'meta_key' );

		if ( empty( $meta_key ) ) {
			if ( is_numeric( $value ) && intval( $value ) !== 0 ) {
				$post = get_post( $value );
			}
		} else if ( ! empty( $value ) ) {
			$args = [
				'fields'         => 'ids',
				'meta_key'       => $meta_key,
				'meta_value'     => $value,
				'posts_per_page' => 1,
				'post_type'      => 'attachment',
				'post_status'    => 'any'
			];

			$query = new WP_Query( $args );

			if ( ! empty( $query->posts ) ) {
				$post = get_post( $query->posts[0] );
			}
		}

		if ( empty( $post ) ) {
			return $value;
		}

		return $post->ID;
	}
public function get_file ( $ value ) { $ meta_key = $ this -> get_setting ( 'meta_key' ) ; if ( empty ( $ meta_key ) ) { if ( is_numeric ( $ value ) && intval ( $ value ) !== 0 ) { $ post = get_post ( $ value ) ; } } else if ( ! empty ( $ value ) ) { $ args = [ 'fields' => 'ids' , 'meta_key' => $ meta_key , 'meta_value' => $ value , 'posts_per_page' => 1 , 'post_type' => 'attachment' , 'post_status' => 'any' ] ; $ query = new WP_Query ( $ args ) ; if ( ! empty ( $ query -> posts ) ) { $ post = get_post ( $ query -> posts [ 0 ] ) ; } } if ( empty ( $ post ) ) { return $ value ; } return $ post -> ID ; }
Get file by id or meta value.

@param  mixed $value

@return int
Get file by id or meta value .