0

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?

0

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

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

  • I tried this last night, but just to confirm I have it right, I have namespace PLUGIN_NAME; use \BP_Attachment; if ( class_exists( '\BP_Attachment', false ) ) ... – mrpritchett Oct 30 '18 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.