WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] is_trackback function (2 posts)

  1. fiddyp
    Member
    Posted 6 years ago #

    I have written a plugin that parses a comment authors feed and appends a titled link to their last blog post at the time of comment submit and it's working nicely (CommentLuv) with comments but it's also appending the last post when the post receives a trackback :-(

    there is a small if statement in the function that is called by the filter preprocess_comment that I use to see if the commenter left a site url, if they didn't I just return the comment contents

    if(!$author_url){
    return $comment_data;
    }

    I thought that changing it to

    if(!$author_url || is_trackback()) {
    return $comment_data;
    }

    would stop the function from carrying on if it had been called with preprocess_comment on a trackback but it doesn't :-(

    how can I tell if the preprocess_comment filter has been triggered by a trackback so I can tell my function not to bother with trying to parse the feed of the trackback-er ?

  2. fiddyp
    Member
    Posted 6 years ago #

    it's ok, I fixed it!
    here's what I put

    if ($user_level > 7 || $comment_data['comment_type'] == 'pingback' || $incoming_comment['comment_type'] == 'trackback') {
    return $comment_data;
    }

    that stops it doing anything if the user posting is an admin or it is a trackback

Topic Closed

This topic has been closed to new replies.

About this Topic