Support » Plugins » Help with $post and $comment

  • I am working on a plugin which applies a filter to a $post and to a $comment. The same filter is applied to both.
    It appears that a $post is run through the filtering system which applies tags in a different order than a $comment. It seems that $comment gets “tagged” at some different point.
    In testing, when I echo the contents of the_content, tags, such as p, etc. have been applied. But when I echo the contents of comment_text, no tags have been applied.
    Is this correct? If so, how can I get tags applied to comment_text before I run it through my filter?
    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • To clarify, this plugin needs the post ID, as well as the comment ID, so I can’t use a method like the “google_hilite” plugin – mine requires looking at each post and comment. I’d rather not do additional queries, as it seems inefficient.
    Any thoughts?

    I solved the problem by adding:
    add_filter('comment_text', 'wpautop');
    before the plugin calls it’s own comment filter.
    But…: it seems that WP should be consistent in how it formats posts and comments for output. This would make it simpler for plugin authors to implement features.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.