snipt

Ctrl+h for KB shortcuts

PHP

Add an options page

1
2
3
4
5
<?php
function wd_custom_settings(){
    add_options_page('WD Options', 'WD Options', 'manage_options', 'wd-options', 'wd_settings_page');
}
add_action('admin_menu', 'wd_custom_settings');
https://snipt.net/embed/b9deffc401ad22c63c4e7c01ac106ff1/
/raw/b9deffc401ad22c63c4e7c01ac106ff1/
b9deffc401ad22c63c4e7c01ac106ff1
php
PHP
5
2019-06-19T00:34:04
True
False
False
Apr 24, 2013 at 11:37 AM
/api/public/snipt/59866/
add-an-options-page
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a><span class="k">function</span> <span class="nf">wd_custom_settings</span><span class="p">(){</span> </span><span id="L-3"><a name="L-3"></a> <span class="nx">add_options_page</span><span class="p">(</span><span class="s1">&#39;WD Options&#39;</span><span class="p">,</span> <span class="s1">&#39;WD Options&#39;</span><span class="p">,</span> <span class="s1">&#39;manage_options&#39;</span><span class="p">,</span> <span class="s1">&#39;wd-options&#39;</span><span class="p">,</span> <span class="s1">&#39;wd_settings_page&#39;</span><span class="p">);</span> </span><span id="L-4"><a name="L-4"></a><span class="p">}</span> </span><span id="L-5"><a name="L-5"></a><span class="nx">add_action</span><span class="p">(</span><span class="s1">&#39;admin_menu&#39;</span><span class="p">,</span> <span class="s1">&#39;wd_custom_settings&#39;</span><span class="p">);</span> </span></pre></div> </td></tr></table>
WordPress, options