Skip to content

Commit

Permalink
✨ 开启REST API
Browse files Browse the repository at this point in the history
  • Loading branch information
Licoy committed Oct 7, 2022
1 parent c65a2e7 commit 5f570b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion inc/fun/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,18 @@ function pk_session_call($function)
}
}

function pk_get_theme_option_url($to=''){
return admin_url() . 'admin.php?page=puock-options&to=' . $to;
}


// 顶部添加自定义菜单
function pk_toolbar_link($bar)
{
$bar->add_node(array(
'id' => 'theme-setting',
'title' => '🎨 主题设置',
'href' => admin_url() . 'admin.php?page=puock-options'
'href' => pk_get_theme_option_url()
));
$bar->add_node(array(
'id' => 'theme-docs',
Expand Down
4 changes: 2 additions & 2 deletions inc/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ function deel_setup()
remove_filter('pre_oembed_result', 'wp_filter_pre_oembed_result', 10);

// 屏蔽 REST API
add_filter('rest_enabled', '__return_false');
add_filter('rest_jsonp_enabled', '__return_false');
// add_filter('rest_enabled', '__return_false');
// add_filter('rest_jsonp_enabled', '__return_false');

// 移除头部 wp-json 标签和 HTTP header 中的 link
remove_action('wp_head', 'rest_output_link_wp_head', 10);
Expand Down

0 comments on commit 5f570b8

Please sign in to comment.