comment_type

The timeline below displays how wordpress function comment_type has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.7

/**
 * Displays the comment type of the current comment.
 *
 * @since 0.71
 *
 * @param string|false $commenttxt   Optional. String to display for comment type. Default false.
 * @param string|false $trackbacktxt Optional. String to display for trackback type. Default false.
 * @param string|false $pingbacktxt  Optional. String to display for pingback type. Default false.
 */
function comment_type($commenttxt = false, $trackbacktxt = false, $pingbacktxt = false)
{
    if (false === $commenttxt) {
        $commenttxt = _x('Comment', 'noun');
    }
    if (false === $trackbacktxt) {
        $trackbacktxt = __('Trackback');
    }
    if (false === $pingbacktxt) {
        $pingbacktxt = __('Pingback');
    }
    $type = get_comment_type();
    switch ($type) {
        case 'trackback':
            echo $trackbacktxt;
            break;
        case 'pingback':
            echo $pingbacktxt;
            break;
        default:
            echo $commenttxt;
    }
}

WordPress Version: 5.4

/**
 * Displays the comment type of the current comment.
 *
 * @since 0.71
 *
 * @param string $commenttxt   Optional. String to display for comment type. Default false.
 * @param string $trackbacktxt Optional. String to display for trackback type. Default false.
 * @param string $pingbacktxt  Optional. String to display for pingback type. Default false.
 */
function comment_type($commenttxt = false, $trackbacktxt = false, $pingbacktxt = false)
{
    if (false === $commenttxt) {
        $commenttxt = _x('Comment', 'noun');
    }
    if (false === $trackbacktxt) {
        $trackbacktxt = __('Trackback');
    }
    if (false === $pingbacktxt) {
        $pingbacktxt = __('Pingback');
    }
    $type = get_comment_type();
    switch ($type) {
        case 'trackback':
            echo $trackbacktxt;
            break;
        case 'pingback':
            echo $pingbacktxt;
            break;
        default:
            echo $commenttxt;
    }
}

WordPress Version: 3.9

/**
 * Display the comment type of the current comment.
 *
 * @since 0.71
 *
 * @param string $commenttxt   Optional. String to display for comment type. Default false.
 * @param string $trackbacktxt Optional. String to display for trackback type. Default false.
 * @param string $pingbacktxt  Optional. String to display for pingback type. Default false.
 */
function comment_type($commenttxt = false, $trackbacktxt = false, $pingbacktxt = false)
{
    if (false === $commenttxt) {
        $commenttxt = _x('Comment', 'noun');
    }
    if (false === $trackbacktxt) {
        $trackbacktxt = __('Trackback');
    }
    if (false === $pingbacktxt) {
        $pingbacktxt = __('Pingback');
    }
    $type = get_comment_type();
    switch ($type) {
        case 'trackback':
            echo $trackbacktxt;
            break;
        case 'pingback':
            echo $pingbacktxt;
            break;
        default:
            echo $commenttxt;
    }
}

WordPress Version: 3.7

/**
 * Display the comment type of the current comment.
 *
 * @since 0.71
 *
 * @param string $commenttxt   Optional. The string to display for comment type. Default false.
 * @param string $trackbacktxt Optional. The string to display for trackback type. Default false.
 * @param string $pingbacktxt  Optional. The string to display for pingback type. Default false.
 */
function comment_type($commenttxt = false, $trackbacktxt = false, $pingbacktxt = false)
{
    if (false === $commenttxt) {
        $commenttxt = _x('Comment', 'noun');
    }
    if (false === $trackbacktxt) {
        $trackbacktxt = __('Trackback');
    }
    if (false === $pingbacktxt) {
        $pingbacktxt = __('Pingback');
    }
    $type = get_comment_type();
    switch ($type) {
        case 'trackback':
            echo $trackbacktxt;
            break;
        case 'pingback':
            echo $pingbacktxt;
            break;
        default:
            echo $commenttxt;
    }
}