Given the first PHP code snippet you posted, I don’t see that you’re using the class yet, which explains why you’re not seeing your classes in the autoload error log that you’re debugging with.
Note that use
will not trigger PHP’s autoloader.
use My_Plugin\Includes;
You need to actually instantiate a class, check that it exists, or do something else that requires the class to actually be loaded into memory at runtime. Only then will the autoload queue receive a request to load one of your class files.
As it stands, the only class you’re using is the Autoloader class itself, which doesn’t need to be autoloaded, because you’ve included the class file explicitly.
Related Posts:
- Reorganization of namespaces
- What does ‘super’ do in Python? – difference between super().__init__() and explicit superclass __init__()
- What is Inversion of Control?
- What is an example of the Liskov Substitution Principle?
- What __init__ and self do in Python?
- When should you use a class vs a struct in C++?
- C++ error ‘Undefined reference to Class::Function()’ [duplicate]
- What’s the difference between a method and a function?
- How do I implement interfaces in python?
- What is polymorphism, what is it for, and how is it used?
- java – invalid method declaration; return type required [duplicate]
- java – invalid method declaration; return type required
- Is C++ an Object Oriented language?
- Difference between abstraction and encapsulation?
- What are metaclasses in Python?
- extends class and implements interface in java
- What is a “driver class”?
- What is difference between functional and imperative programming languages?
- How can I create a copy of an object in Python?
- What is polymorphism in Javascript?
- When should I be using classes in Python?
- How to create a subclass in C#?
- How would one write object-oriented code in C?
- How to get a JavaScript object’s class?
- Inheritance vs. Aggregation [closed]
- What is the difference between an Instance and an Object?
- What does ‘low in coupling and high in cohesion’ mean
- What is an example of the Single Responsibility Principle?
- Will WordPress become completely OOP?
- How to name files of namespaced classes?
- add_action in namespace not working
- What is the best way to instantiate a class of a plugin in your WordPress theme?
- problem with implementing widget via the_content()
- Load classes using spl_autoload_register
- UML diagrams of WordPress
- Trying to get property of non-object
- Static vs Dynamic methods in WordPress
- Why is a wp function used in current PHP namespace’s callback not resolved to global scope?
- Problem with autoloader and namespaces
- Integration tests test script enqueue/register fails
- Error of “Call a member function on non object” while var_dump get correct result
- add_action in namespace not working
- How pass args to wp_list_comments callback?
- How to call a WP Class inside my theme
- Does &$this is really disallowed to use anywhere?
- Don’t filters violate the a class’ local variables visibility rules?
- Admin submenu does not call function to load the page
- Using Geo Data Store Plugin Code
- How to wait for WordPress Core to load when writing OOP?
- OOP – from plugin add new object and call static method in another file
- How to get parameters with add_filter with a static method?
- Meaning of @classmethod and @staticmethod for beginner?
- What is the difference between object-oriented languages and non object-oriented languages?
- What is the syntax for accessing PHP object properties?
- Pass arguments to Constructor in VBA
- When/why to make function private in class?
- Error: invalid use of member in static member function
- How to remove a filter that is an anonymous object?
- Should all plugins be encapsulated in a Class?
- Registering Class methods as hook callbacks
- Using Ajax with a Class file
- Namespaces in WordPress – How do I initiate the main class?
- How to include one class/instance without using global variables
- syntax for remove_filter in parent theme with class
- Implementing namespaces in plugin template
- PHP5, Inheritance, Singleton – action & filter hook limitations
- Ajax Request not coming back to class
- How to do conditional publishing?
- Creating a menu page in a Object Oriented developed plugin
- Current user in plugin returns NULL
- How to structure a plugin into multiple files using classes?
- Conditional tags inside a class
- Namespaces declared by a theme/plugin should start with the theme/plugin prefix. Found: “eustatos\test_plugin”
- WP Optimization: Removing Orphaned wp_options (especially the autoload ones)
- Creating a shortcode, but getting tied up with OOP and Classes?
- How to add in my plugin a third vendor Git project with composer.json
- Trying to get property of non-object “ wordpress ”
- Use Repository Pattern in WP theme
- Why namespaces are rarely used in WordPress plugins?
- How to Set Taxonomy Object Description?
- REST route from a plugin not working if WordPress is installed in a subdirectory
- A question about add_action()
- Check class_exists before class definition / Doxygen problem
- PHP Helper Class to create shortcodes
- wp_ajax handler with multiple class instances
- OOP PHP class extends TwentyTwenty_Customize in Child Theme
- WooCommerce custom product type not saving with namespaces
- Plugin Development using classes – Public & Private Callbacks
- can I extend the WP_Query class to deal with ‘duplicate’ posts created by joining to wp_posts?
- Why does wp_die() not work when inside a namespace?
- Hiding class namespace from plugin’s extensions
- OOP development and hooks
- Update body class based on theme as well as a html attribute
- How to Maintain url on form submit
- accessibility of an object created in a plugin, from the header
- Best way to access variables in template markup
- Object oriented programming, add_action in constructor not firing
- calling a function from a class in your template
- OOP Plugin: Where should I place the action hooks in the class?
- Is it possible to make get variable out of filter in Class?