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

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

通过 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 全部设置

推荐阅读:
The Ultimate LinkedIn Cheat Sheet  Amazon Email Scam Has Consumers On High Alert  Department Of Justice Announces ‘Hack The Army’ Program  7 Things You Must Do After Installing Your WordPress Site  New Report Discovers Disconnect Between Retailers And Social Med  Counting the Prime Arrangements  The Minimum Absolute Difference Algorithm of an Array  Implement the Depth First Search Algorithm in Graph using Simple  Beginner’s Introduction to PHP Memcached  Using the Regular Expression to Replace External Links in WordPr 
评论列表
添加评论