[wp-trac] [WordPress Trac] #16490: Rename is_x_admin() functions to in_x_admin()

WordPress Trac wp-trac at lists.automattic.com
Tue Feb 8 15:58:20 UTC 2011


#16490: Rename is_x_admin() functions to in_x_admin()
----------------------------+-----------------------------
 Reporter:  apeatling       |      Owner:
     Type:  enhancement     |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Administration  |    Version:  3.1
 Severity:  normal          |   Keywords:  has-patch
----------------------------+-----------------------------
 The functions `is_admin()`, `is_blog_admin()`, `is_network_admin()` and
 `is_user_admin()` all share the same problem -- they read like they are
 checking user capabilities.

 This is made worse with genuine user capability checking functions like
 `is_super_admin()`.

 When writing code utilizing these functions it's simple to confuse other
 developers since they'd automatically assume that `if ( is_user_admin() )
 {}` is checking if a user is an admin.

 Since all of these functions other than `is_admin()` are new in 3.1, I'm
 hoping we can avoid compounding the problem in the next release and change
 them all to `in_x_admin()` since this more accurately reflects what the
 functions are doing -- checking if the request is inside an admin page.

 I've attached a patch with the changes needed. I've also deprecated the
 `is_admin()` function and replaced it with `in_admin()`.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16490>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list