我想将下面的过滤器包装成一个条件,测试用户是否从媒体管理器(Admin>Media>Add New)而不是从post editor图像上载例程上载图像。
有可能知道吗$pagenow在这两种情况下似乎是相同的。。。
//no extra thumbs
global $pagenow;
if($pagenow=="media-new.php"){
add_filter(\'intermediate_image_sizes_advanced\',\'ce4_no_thumbs\');
}
function ce4_no_thumbs($sizes){return array();}
更新:当从帖子中访问上传时,查询字符串上似乎有一个post\\u id,而不是通过“media manager>add new”访问时,但是,在任何一种情况下,以下测试都会通过。。。if ( is_admin() && !isset($_GET[\'post_id\']) ) {
/*This should not fire if user is uploading an image into a post,
since post_id is on the querystring. However, in my test
its still getting through.*/
add_filter(\'intermediate_image_sizes_advanced\',\'ce4_no_thumbs\');
}