Opened 3 years ago
Issue with wp_theme_update_row() setting $details_url
|Reported by:||valendesigns||Owned by:|
I'm building my own theme auto update script and everything was working perfectly, until I ran into a weird bug.
When you're running WordPress in Multisite the $details_url for themes with an update available is set differently than when running WordPress in single site mode.
In single site mode the details url is set inside the theme_update_available() function found in this file /wp-admin/includes/theme.php. It uses the returned 'url' like so.
$details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']);
However, in Multisite the url is built completely different. It uses the wp_theme_update_row() function in the /wp-admin/includes/update.php file like so.
$details_url = self_admin_url("theme-install.php?tab=theme-information&theme=$theme_key&TB_iframe=true&width=600&height=400");
I'm not exactly sure what the best approach would be to fixing this. I know there is a reason why the url is set like that but without a way to change it for my personal themes (i.e. filter or something) I'm stuck with a broken details screen in Multisite.
I did just add a filter to test it and was successful in fixing the issue, but not sure how to proceed from here.
$details_url = apply_filters( 'network_details_url', self_admin_url("theme-install.php?tab=theme-information&theme=$theme_key&TB_iframe=true&width=600&height=400"), $theme_key, $theme );
Thanks for any help you can give me.