2015-07-03 57 views

回答

0

可以使用get_current_screen()功能(Link to codex)来检查,你是一个后编辑页面上,然后让帖子ID具有全球$post变量。

例子:

add_action('admin_notices', 'screen_info'); 
function screen_info() { 
    $screen = get_current_screen(); 
    if(is_admin() && $screen->id == 'post') { 
    global $post; 
    $post_id = get_the_ID(); 
    // your code here 
    } 
} 
+0

谢谢。我发现我可以使用'add_meta_box',它按预期工作。不过谢谢!周末愉快。 –