2017-09-07 75 views
0

我需要當用戶進入到檢測:WordPress的:檢測插件和主題界面激活

插件 - >安裝的插件和外觀 - >主題

在WordPress管理。

喜歡的東西:

add_action("core_upgrade_preamble", "action_core_upgrade_preamble") 
+0

如果他們去那個部分你想做什麼? –

+0

我想添加一些內容到該部分 – Sevak

回答

0

你有2種選擇:

選項1
使用回調$鉤,使用這首獲得頁面的$hook

function load_custom_wp_admin_style($hook) { 
     var_dump($hook); 
} 
add_action('admin_init', 'load_custom_wp_admin_style'); 

檢查你的網頁在瀏覽器中你應該得到的字符串名稱,那麼你可以我們E:

function load_custom_wp_admin_style($hook) { 
     // Load only on my specific page 
     if($hook != 'page_hook_i_got') { 
       return; 
     } 
     //DO MY LOGIC 

} 
add_action('admin_init', 'load_custom_wp_admin_style'); 

選項2
使用get_current_screen();

add_action('current_screen', 'this_screen'); 

function this_screen() { 

    $current_screen = get_current_screen(); 

    if($current_screen ->id === "widgets") { 

     // Run some code, only on the admin widgets page 

    } 

} 

,你需要做一個var_dump找到該網頁的id,就像選項1,你可以找到更多信息here

+0

我做了它與選項2.工作很好!謝謝!! – Sevak

相關問題