Right, to answer my own stupidity.
spl_autoload_register
is called when you instantiate a class.
Moving new water();
from file water.php to file test.php solves the problem.
The test.php should then look like this:
<?php
/*
Plugin Name: test
Plugin URI: test
Description:
Version: 1.0
Author: test
Author URI: test
*/
class test_main {
public function __construct() {
include_once( 'includes/autoloader.php' );
}
}
new test_main();
new water();
Related Posts:
- 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?
- What is the best way to instantiate a class of a plugin in your WordPress theme?
- problem with implementing widget via the_content()
- UML diagrams of WordPress
- Trying to get property of non-object
- Static vs Dynamic methods in WordPress
- Autoloader not finding classes from my plugin
- Integration tests test script enqueue/register fails
- Error of “Call a member function on non object” while var_dump get correct result
- How pass args to wp_list_comments callback?
- 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?
- Are static class variables possible in Python?
- What is a mixin, and why are they useful?
- Error at constructor : Expected an identifier?
- What is Serialization?
- When should I use ‘self’ over ‘$this’?
- Polymorphism vs Overriding vs Overloading
- fatal error LNK1169: one or more multiply defined symbols found in game programming
- Python function overloading
- Why is there no multiple inheritance in Java, but implementing multiple interfaces is allowed?
- How can I design a class named allergy?
- C++ equivalent of java’s instanceof
- Get plugin_dir_url() from one level deep within plugin
- How to use classes declared in another plugin?
- Does an activated plugin automatically mean its methods are available to other WP functions?
- Single Responsibility Principle and WP Classes
- Is it possible to change the attributes of a registered style or script before it fires?
- How to initialize $wpdb?
- Wrapper class: How to get rid of call_user_func_array() warning?
- Where is the “ancestors” post object attribute?
- set_sale_price in WooCommerce [closed]
- Check to see if page exists problems
- Is it a good practice to include custom options when registering a post type?
- How do you render_callback for register_block_type to a method in another class?
- Advice on plugin structure
- Using $post->post_name in body id causing error: Trying to get property of non-object
- Same taxonomy for different object types
- plugin class inheritance. cannot change variable
- What is the proper method of using global $post?
- Using plugin functions/methods within templates
- accessing parent variables in child construct without executing action in parent
- OOP and WordPress shortcode
- Remove an action by extending class and replacing it
- Extend Woocommerce Widget Class – WC_Widget_Product_Categories
- Need oop for wordpress theme? [duplicate]
- Remove an action added within a class in a WordPress plugin
- Benefits over using object method over property from $product?
- Class property seems to lose scope, attached to save_post action?
- wp_nav_menu inside an object — how do I deal with fallback_cb?
- Wp ajax not working from “current_screen” admin hook
- add_action in namespace not working
- Call to “admin_notices” hook from a static method
- functions won’t fire after I converted my code from procedural code to OOP
- Custom Post Type works when registered in functions.php but not when registered in plugin
- Pass an argument into a function to extract from array
- How to add typehints to function in functions.php when argument is an object?
- How to implement AJAX within a class storing shortcode atts as class variables
- Autoloading a PHP class – working outside, but not inside WordPress plugin
- Property value of null when value is assigned inside a method hooked to the wp action hook
- How to execute add_action() function from custom plugin to Crontrol plugin or do_action()?
- Class property not visible inside ajax callback function?
- How To Remove The Filter That Adds JetPack Related Content To Dom [closed]
- Strict Standards: Non-static method in sidebar generator
- Plugin: Custom menu item problem
- How to remove a filter that is an object method?
- How can I modify or filter this variable in an existing class? (Mai Theme)