possible typo

Posted in: Newspaper
Post count: 388

Should this condition in includes/wp_booster:

function __construct($post) {
if (gettype($post) != 'object' or get_class($post) != 'WP_Post') {
td_util::error(__FILE__, 'td_module: ' . get_Class($this) . '($post): $post is not WP_Post');
}

Perhaps have “and” instead of “or”?

As it stands, it complains that the posts I’m getting are “not WP_Post”, which is true, but they are objects (admittedly stdClass) queried in the normal way from the wpdb; and the module is perfectly capable of rendering them. So I get a bunch of error output followed by a correctly formatted module.

Just a thought!

Post count: 780

Hi,

I would suggest to instantiate the WP_Post class. I did not test that yet. We have to make sure that modules get a WP_Post object because we depend on methods from it.

Post count: 388

That was my other thought, in which I’m not sure why you need the first half of the condition. I just ended up using WP’s get_post to make a proper object, which is more reads, but not too bad. Thank you!

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.