2019-09-24_141559

The BunnyCDN plugin ( https://wordpress.org/plugins/bunnycdn/ ) does a good job in replacing all static resources URL into a CDN link (for example: yoursite.b-cdn.net/link/to/your/resource.jpg).

However, if you use “Paged Style” reading mode in chapter reading, the next/prev image link will not work. The BunnyCDN plugin cannot replace URL correctly.

To fix this, add this code to your functions.php file of your theme (it’s better to put it in your child theme functions.php file)

add_filter(‘wp_manga_chapter_image_url’, ‘my_wp_manga_chapter_image_url’, 100, 5);
function my_wp_manga_chapter_image_url($url, $host, $link, $post_id, $name){
$your_domain = ‘yourdomain.com’;
$your_bunny_cdn = ‘xxx.b-cdn.net’;
$url = str_replace($your_domain, $your_bunny_cdn, $url);
return $url;
}

Replace your domain URL and your bunny CDN link appropriately. (when copying the code, make sure you use correct single quote character ‘ )

Note that: The CDN link will store a cache version of your resource. Images are still stores on your server. If you need an add-on to store images on BunnyCDN without storing on your server (to save storage), use our FTP add-on https://mangabooth.com/product/wp-manga-ftp-storage/

SHARE THIS POST

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

*

1 × 1 =