Make WordPress Core

Changeset 59154


Ignore:
Timestamp:
10/01/2024 05:23:37 PM (8 months ago)
Author:
cbravobernal
Message:

Script Modules: prevent broken links by using includes_url.

[59083] introduced an issue where Script Modules registered src does not correctly respect the includes path.

Before that change, script modules were registered using includes_url. The patch used a hard-coded path which breaks when sites are not served from the root, e.g. the site root is https://example.com/wp instead of https://example.com/.

Follow-up to [59083].

Props nendeb55, jonsurrell, cbravobernal.

Fixes #62146.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-modules.php

    r59083 r59154  
    170170        }
    171171
    172         $path = "/wp-includes/js/dist/script-modules/{$file_name}";
     172        $path = includes_url( "js/dist/script-modules/{$file_name}" );
    173173        wp_register_script_module( $script_module_id, $path, $script_module_data['dependencies'], $script_module_data['version'] );
    174174    }
Note: See TracChangeset for help on using the changeset viewer.