Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

PHP

Get current page in WordPress admin

1
2
3
4
5
<?php
$current_screen = get_current_screen();
if ($current_screen->id === 'plugins') {
// http://codex.wordpress.org/Plugin_API/Admin_Screen_Reference
}
https://snipt.net/embed/6ebcd5ed617384a8fe068f24a6d354b9/
https://snipt.net/raw/6ebcd5ed617384a8fe068f24a6d354b9/
6ebcd5ed617384a8fe068f24a6d354b9
php
PHP
5
2016-12-05T08:17:33
True
False
False
Jun 16, 2016 at 08:46 AM
/api/public/snipt/147210/
get-current-page-in-wordpress-admin
<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="nv">$current_screen</span> <span class="o">=</span> <span class="nx">get_current_screen</span><span class="p">();</span> </span><span id="L-3"><a name="L-3"></a><span class="k">if</span> <span class="p">(</span><span class="nv">$current_screen</span><span class="o">-&gt;</span><span class="na">id</span> <span class="o">===</span> <span class="s1">&#39;plugins&#39;</span><span class="p">)</span> <span class="p">{</span> </span><span id="L-4"><a name="L-4"></a><span class="c1">// http://codex.wordpress.org/Plugin_API/Admin_Screen_Reference</span> </span><span id="L-5"><a name="L-5"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
admin, dashboard, wordpress
Copyrighted, illegal, or inappropriate content? Email [email protected].