为 wordpress 后台添加“全部设置”选项

  • 时间:2020-05-16 19:39:54
  • 分类:网络文摘
  • 阅读:159 次

通过 wordpress 的“全部设置”选项可以对自定义字段值、插件设置、常规设置、主题设置等进行修改,相当于在数据库之外修改wp_options数据表。

这个“全部设置”选项默认是隐藏的,平时可以使用 http://yourdomain.com/wp-admin/options.php 链接打开。如果不想每次都输入链接,可以将此选项在后台开启,方便调用。

具体方法:

将下例代码添加到当前 wordpress主题的配置文件 functions.php 中,保存即可。

  1. // 显示全部设置选项
  2. function all_settings_link() {
  3.     add_options_page(__('All Settings'), __('All Settings'), 'administrator', 'options.php');
  4. }
  5. add_action('admin_menu', 'all_settings_link');

登陆后台就可以看到在“设置”菜单中多了一个“全部设置”的选项,如下图所示:

开启wordpress 全部设置

推荐阅读:
What Should You Blog About During the Pandemic and Beyond?  6 Tips For Starting a Business During a Pandemic  Will Your Blog be affected by the Current Facebook Ad Boycott?  Unobvious Life Hacks for Ads Optimization in Google  Essential Traits That Will Help Bloggers Work From Home Successf  Examining the Physical and Mental Health of Writers and Bloggers  How will Blogging Change after the Pandemic?  Digital Relationships: 5 Tips For Building A Better Veterinary B  The 2020 Pandemic Further Boosts Earnings and Influence of Blogg  What to Do When Your Blog Gets Too Big for You Alone 
评论列表
添加评论