mansj / enable-media-replace

***DEVELOPMENT DISCONTINUED*** Enable Media Replace, a WordPress plugin to make it possible to replace uploaded media files in a simple way.
GNU General Public License v2.0
28 stars 27 forks source link

Make $returnurl filterable, use admin_url #27

Closed ururk closed 7 years ago

ururk commented 7 years ago

I have a need to direct a user to the media upload page ("wp-admin/upload.php?item=POST_ID") instead of the post edit page for the media item. This is because of a role plugin that (intentionally) blocks access to the posts edit page. I've added a filter right before the redirection call (though it could possibly go above if (FORCE_SSL_ADMIN) {).

To use, in functions.php:

function change_enable_media_replace_returnurl( $returnurl ) {
    return admin_url( "upload.php?item=" . (int) $_POST["ID"] );
}
add_filter( 'emr_returnurl', 'change_enable_media_replace_returnurl' );