Index: web/wp/wp-includes/media.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/web/wp/wp-includes/media.php b/web/wp/wp-includes/media.php
--- a/web/wp/wp-includes/media.php	
+++ b/web/wp/wp-includes/media.php	(date 1717600259274)
@@ -5307,6 +5307,19 @@
 function attachment_url_to_postid( $url ) {
 	global $wpdb;
 
+    /**
+     * Allows to short circuit the function by providing the post ID custom method.
+     *
+     * @since tbd
+     *
+     * @param int|null $post_id The post_id (if any) found by the function.
+     * @param string   $url     The URL being looked up.
+     */
+    $post_id = apply_filters( 'pre_attachment_url_to_postid', null, $url );
+    if ( null !== $post_id ) {
+        return (int) $post_id;
+    }
+
 	$dir  = wp_get_upload_dir();
 	$path = $url;
 
