BuddyPress and namespacing

I'm using PSR-4 autoloading and namespacing for a new plugin. However, because my plugin is namespaced (and all it's classes are), I can't seem to extend a BuddyPress class (BP_Attachment) successfully as it doesn't want to pass the if ( class_exists( 'BP_Attachment', false ) ) check. I've tried to require it, "use" it, and more. Nothing works. Since BuddyPress doesn't use namespacing am I out of luck?

Topic autoloading plugin-development buddypress Wordpress

Category Web


Try using if ( class_exists( '\BP_Attachment', false ) )?

Could be that you need to tell PHP that the class is in the global namespace

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.