Keeping Objects in Memory

This is a perfect use case for Transients. In WordPress, transients are short-lived data objects. By default, they’re persisted to the database using WordPress’ built-in WP_Object_Cache object. However, you can use a variety of caching plugins (Batcache is an outstanding one that works with Memcached) to store Transients in memory. To set a transient, call …

Read more

How to get parameters with add_filter with a static method?

First, consult the documentation or source code to see how many arguments are passed to the filter. We can see it has 3 in total, and the comments object is the second one, so you’ll need to have at least two. Next, you’ll want to declare the number of arguments to pass to the function …

Read more

$_html is empty when var dumped

so I turn to you guys to help me see what I am doing wrong here. First thing your doing wrong is over complicating a simple effective API. Your code makes no sense. Your mixing functions that echo output with arbitrary html mark up that gets assigned to a non existing class property that nothing …

Read more

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