Strict Standards: Non-static method in sidebar generator

There’s not a huge amount you can do about this. Many developers turn off strict errors, as they are pervasive (there are even some in core). Of course it could be fixed – but then what? It’s a plugin, so the next time you update that plugin, your changes will be overwritten.

Method not receiving attributes from shortcode call, general OOP problems

First, you have to initiate the class, something like: add_action( ‘init’, function() { $CsvImporter = new CsvImporter; } ); Also, you are using extract() wrong; extract() won’t build $attributes as an array. Anyway, extract() is not recommended any more and you should avoid using it. Also, note taht if ($attributes[‘mods’]) should be if ($attributes[‘type’] == … Read more

Using add action for class with construct

above code does not works for me, is not correct or any mistake from my side? And it didn’t work for me either. Because it throws this fatal error: PHP Fatal error: No code may exist outside of namespace {} in … And that’s because the PHP manual says: No PHP code may exist outside … Read more

How To Remove The Filter That Adds JetPack Related Content To Dom [closed]

$jprp = Jetpack_RelatedPosts::init(); remove_filter( ‘the_content’, array( $jprp, ‘filter_add_target_to_dom’ ) ); Should work fine. The Jetpack_RelatedPosts init function implements the singleton pattern, so calling it will return the already instantiated instance, which you can use to remove the filter. Just make sure you call your code late enough. The main module is hooking the add_action to … Read more

Class property not visible inside ajax callback function?

Have you used AJAX before? Do you know what the acronym stands for? Hint: The J stands for javascript. Indeed, AJAX is usually invoked using javascript/jQuery. I believe that’s why you’re not receiving a response: you aren’t invoking an AJAX protocol or going through WordPress’s admin-ajax.php. And, why would you put a callback function in … Read more

How to wait for WordPress Core to load when writing OOP?

The core problem is that you are not writing OOP. OOP is about identifying objects in your system, not actions. If you want to identify actions than you are better to follow functional design paradigms (and with wordpress hook system, functional design make much more sense). In your case redirect is an action, that probably … Read more