Make WordPress Core

Ticket #61383: attachment_url_to_postid.patch

File attachment_url_to_postid.patch, 916 bytes (added by apermo, 8 months ago)

Patch for the ticket.

  • 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 b  
    53075307function attachment_url_to_postid( $url ) {
    53085308        global $wpdb;
    53095309
     5310    /**
     5311     * Allows to short circuit the function by providing the post ID custom method.
     5312     *
     5313     * @since tbd
     5314     *
     5315     * @param int|null $post_id The post_id (if any) found by the function.
     5316     * @param string   $url     The URL being looked up.
     5317     */
     5318    $post_id = apply_filters( 'pre_attachment_url_to_postid', null, $url );
     5319    if ( null !== $post_id ) {
     5320        return (int) $post_id;
     5321    }
     5322
    53105323        $dir  = wp_get_upload_dir();
    53115324        $path = $url;
    53125325