LMS & eLearning

LearnDash Certificate Shows the Wrong Date or Score: Causes and Fixes

Why a LearnDash certificate prints a date a day off, the wrong attempt, a score that changed after essay grading, or today's date for an old completion. Each cause traced to the stored data, with the fix.

LearnDash Certificate Shows the Wrong Date or Score: Causes and Fixes

A certificate with the wrong date or score is worse than no certificate, because the learner notices and the credential looks unreliable. In LearnDash 4.18.0.1 the values on a classic certificate come from a handful of stored fields read by the [courseinfo] and [quizinfo] shortcodes, and each of the common complaints maps to a specific place where the stored value or the lookup is not what you expect. This guide goes through the complaints one by one, shows where the value comes from in the plugin, and gives the fix.

Where the values come from

  • Course completion date: [courseinfo show="completed_on"] reads the user meta course_completed_{course_id}, a Unix timestamp written with time() when the course status became complete. If the meta is missing it falls back to learndash_user_get_course_completed_date(), which reads the activity table, and prints a dash if both are empty.
  • Quiz date: [quizinfo show="timestamp"] reads the attempt's time, also a Unix timestamp set with time() when the attempt was saved.
  • Quiz score: show="percentage" reads the attempt's percentage, computing it from score and count if empty; show="score", points, total_points and count print the stored values directly; show="pass" prints Yes or No from the stored flag.
  • Formatting: dates pass through learndash_adjust_date_time_display(), which converts the timestamp from UTC to the site timezone and applies the format attribute, or the site date and time formats when none is given.

Complaint 1: the date is a day off

Timestamps are stored in UTC and displayed in the timezone set under Settings, then General. A site set to UTC with learners in Australia prints the previous day for completions made in their morning. Set the site timezone to a named city rather than a UTC offset, so daylight saving is handled, and accept that a site serving several continents prints the site's day, not the learner's. If each learner's own date matters, store the learner timezone in user meta and format the timestamp with it in a learndash_courseinfo filter callback, which receives the output and the shortcode attributes.

A related case: a date that is off by exactly the server's timezone offset on an older site usually means a plugin or theme called date_default_timezone_set(), which WordPress expects nobody to do. Search the codebase for it.

Complaint 2: the certificate shows today's date

If completed_on prints the date the certificate was opened rather than the completion date, the content is not using that shortcode at all; a [courseinfo show="completed_on"] always prints the stored completion. Look for a date inserted with a generic shortcode or a theme function that prints the current date, and replace it. In the Certificate Builder, check that the Course Info block is set to completed on rather than a static date.

Complaint 3: the date is the enrolment or the last lesson, not the final step

The completion timestamp is the moment the course status became complete, which is when the last required step was marked complete. If an administrator marked the course complete from the profile, it is that moment. If a Data Upgrade rebuilt progress, completions recorded by the upgrade carry the time it ran, which is why some sites see a cluster of certificates dated the same day. There is no stored "intended" date to recover; where the real date is known from the activity table, a developer can correct the course_completed_ meta for affected users.

Complaint 4: the quiz certificate shows the wrong attempt

When a learner has several attempts, [quizinfo] picks the attempt whose time matches the time argument in the certificate link, and falls back to the last stored attempt for that quiz when there is no match. Links from the quiz results page and the profile include the attempt time, so they print that attempt. A link built without time, for example from a custom button or an email, prints the most recent attempt, which may be a later failed one with a lower score. Always build quiz certificate links with the attempt time appended, as the [ld_certificate] shortcode does; the certificate download button guide shows the attribute.

Complaint 5: the score changed after grading

Quizzes with essay questions are saved with the auto-gradable score, and the attempt's has_graded flag set. When a grader awards points, LearnDash updates the attempt's score, points, percentage and pass values in place. Because PDFs are generated on request, a certificate opened before grading shows the provisional score and one opened afterwards shows the final one; a learner who saved the early file keeps the old number. Tell learners to download after grading, or withhold the certificate until grading is complete by using the quiz's certificate threshold so that the provisional score does not qualify, or by delaying the link as in hiding the certificate link until a date.

Complaint 6: the percentage does not match the results page

The results page can show a points-based percentage while show="percentage" prints the stored value, which is rounded to two decimals after essay grading and to the quiz's own rounding at submission. Small differences come from rounding; large ones mean a different attempt is being shown, per complaint 4. To print a whole number, format it in a learndash_quizinfo filter callback, which receives the output, the attributes and the selected attempt:

<?php
add_filter(
    'learndash_quizinfo',
    function ( $output, $atts, $attempt ) {
        if ( 'percentage' === $atts['show'] && is_numeric( $output ) ) {
            return (string) round( (float) $output );
        }
        return $output;
    },
    10,
    3
);

Complaint 7: the date prints as a dash or a raw number

A dash from completed_on means neither the meta nor the activity table has a completion for that user and course, which happens when enrolment was imported with "completed" status but no activity, or when the course was completed under a different user ID before an account merge. Record a completion through LearnDash, for example by marking the course complete from the profile, or write the meta directly. A raw number such as 1761350400 means the shortcode's format attribute was set to something PHP's date function does not understand; use a valid format string such as F j, Y. The completion date and score guide lists working formats.

Complaint 8: the wrong learner's data

When an administrator opens a learner's certificate from the profile, LearnDash switches the current user so the shortcodes read the learner. If a custom link omits the user argument, or a staff member opens a learner's bookmarked URL, the nonce fails rather than showing wrong data. Wrong-learner output therefore almost always comes from a custom shortcode or filter that reads wp_get_current_user() before the switch, or from a page cache serving one learner's certificate page to another. Exclude the certificate post type from full-page caching.

Checking the stored values

For a course, the user's completion timestamp is visible in the LearnDash section of their profile and in the user meta table under course_completed_{id}. For a quiz, the attempt list in the profile shows date and score, and the _sfwd-quizzes meta holds the raw array. Compare those with the certificate before changing anything; if the stored value is wrong, the certificate is only reporting it.

When to get help

Correcting completion dates in bulk after a migration, printing learner-local dates, or auditing which attempt each issued certificate used are tasks our LearnDash services team handles regularly; a LearnDash developer can write the correction script against the activity table in a few hours.

Frequently asked questions

Why is the date on my LearnDash certificate one day early?

Timestamps are stored in UTC and shown in the site timezone. Set a named timezone under Settings, then General, and remember that learners in other regions see the site's date.

Why does the quiz certificate show a failed attempt's score?

The link had no time argument, so the shortcode fell back to the most recent attempt. Build links with the attempt time, as the results page does.

Can a certificate change after it was downloaded?

The stored file cannot, but a new download reflects current data, including scores updated by essay grading and any edits to the certificate design.

Why does the completion date print a dash?

No completion is recorded in user meta or the activity table for that user and course, usually after an import. Record one through LearnDash or write the meta.

Add WorldWin Coder to your preferred sources

Add worldwincoder.com as a preferred source on Google, or open this article in your AI assistant to use it as a source.

· Developers and project managers

Articles written and reviewed by the developers and project managers at WorldWin Coder, who build and maintain websites, web applications and mobile apps on WordPress, Moodle, PHP, Laravel, CodeIgniter and Flutter.

Free consultation

Need help with LearnDash?

Tell us what you are working on. A developer who does this every week reads your message and replies within one business day with next steps and a free quote.

  • Free consultation and quote
  • NDA on request
  • You own the source code
  • Reply within one business day

Tell us about your project

Add budget and timeline optional, helps us quote faster

This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Keep reading

Have something to build, fix or move?

Tell us where you are. A developer reads every inquiry, and you get next steps and a free quote within one business day.