As to which assets are filterable, it varies. You’d have to track down how each is referenced and trace through source code. Identifying filters in syntax highlighted source code is relatively easy, but all the various ways assets are referenced start adding up.
]]>Then as you have suggested, I should not edit core files but I can relocate other files right ?
I am trying to use of full facility of object storage and minimalist wordpress docker development.
Thanks for the reply, any further reply to clear my understanding ?
]]>Perhaps an even bigger issue is many of these files are updated when WP is updated. After each update, you would again need to move these files to DO storage.
How and where these files are referenced in core is quite varied and diverse. For each file you want to move, find where it’s referenced in served pages, then identify the code responsible for that output. Review the code to see if there is an apply_filters() call or some related mechanism where the link can be altered through custom plugin code without altering core code.
Let’s look at just one static file reference as an example. One of the most referenced of static files is /wp-includes/js/jquery/jquery.js. This file is not literally filterable by using add_filter() hooks, but it is a registered and enqueued script file, so it can be deregistered and reregistered using a new path.
Script registration for front end pages is done during the “wp_enqueue_scripts” action. In your custom plugin, hook this action with a large priority argument so your callback is called later than core callbacks. Within your action callback, you might have this:
wp_deregister_script('jquery');
wp_register_script('jquery', 'https://www.storage-url.com/path-to-your-account/jquery/jquery.js');
Now when any code enqueues jQuery, the script tag src attribute will reference storage-url.com instead of your domain name.
Similar research and solutions are required for every file you want to move. In many cases, there may not be any solution available and the file cannot be properly relocated.
]]>Thanks.
]]>