PHP code example of humanmade / replace-files
1. Go to this page and download the library: Download humanmade/replace-files library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
humanmade / replace-files example snippets
add_action( 'replace_files.merge_replacement.replaced', function ( $post_id ) {
// Purge the server's cache.
wp_remote_request( wp_get_attachment_url( $post_id ), [
'method' => 'PURGE',
]);
});