• Resolved Boone Gorges

    (@boonebgorges)


    When visiting a tag page (/events/tags/foo/), EM fakes a WordPress post in order to load within the theme template. See EM_Tag_Taxonomy::template(). Manually modifying $wp_query->queried_object and $wp_query->post is of questionable wisdom, though I understand why it’s being done 🙂 Anyway, the post object is not being filled in completely. In particular, $wp_query->post->comment_count is empty, which means that any theme using get_comments_number() in the comments template (pretty standard practice – see twentytwelve for an example) will throw a PHP notice because an empty string, rather than a float, is being passed to number_format() via number_format_i18n().

    Barring a rethink of the $wp_query->post strategy 🙂 I think the following will fix the immediate problem:

    $wp_query->post->comment_count = 0;

    On the client site where I’m seeing the error, I’m doing the following as a temporary (though harmless) fix:

    add_filter( 'get_comments_number', 'intval' );

    https://wordpress.org/plugins/events-manager/

Viewing 1 replies (of 1 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    hmm, I tried this one and seems to be working fine for me; are you using the latest EM and WP version? also, do have other theme we can test?

Viewing 1 replies (of 1 total)
  • The topic ‘Tag page resulting in `get_comments_number()` notice’ is closed to new replies.