[wp-trac] [WordPress Trac] #64131: A new function to test if a thing is an instance of the WP_User class

WordPress Trac noreply at wordpress.org
Tue Oct 21 20:34:47 UTC 2025


#64131: A new function to test if a thing is an instance of the WP_User class
-----------------------------+------------------------------
 Reporter:  profiletoggler   |       Owner:  (none)
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Users            |     Version:  trunk
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------

Comment (by profiletoggler):

 A current function,{{{is_wp_error}}}, does something similar regarding the
 {{{WP_Error class}}}:
 https://developer.wordpress.org/reference/functions/is_wp_error/ .When
 developing my plugin, Describr (https://wordpress.org/plugins/describr/),
 I used namespaces, and it became tedious doing {{{$thing instanceof
 \WP_User}}} often to break out of the namespaces. Replying to [comment:1
 swissspidy]:
 > Hi there and welcome to WordPress Trac!
 >
 > What would be the benefit of adding a function simply wrapping an
 `instanceof` check? Why not just use `instanceof` directly?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64131#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list