Skip to content

valu-digital/replace-files

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Replace Files

This plugin allows you to upload a replacement for an existing attachment.

Cache Busting

Replacements use the same filename as the original, allowing existing links to continue working. However, this may require busting the cache to expose the new image. You can use the replace_files.merge_replacement.replaced action to handle this:

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',
	]);
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 89.9%
  • JavaScript 10.1%