2015-07-03 60 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',它按預期工作。不過謝謝!週末愉快。 –